Skip to content

Instantly share code, notes, and snippets.

@dstrunk
Last active April 13, 2018 14:12
Show Gist options
  • Save dstrunk/fbb9631e9282d8379d0da482b40ac412 to your computer and use it in GitHub Desktop.
Save dstrunk/fbb9631e9282d8379d0da482b40ac412 to your computer and use it in GitHub Desktop.
Laravel Mix config for Elixir Phoenix applications
use Mix.Config
# Untouched information omitted for brevity's sake
config :project, ProjectWeb.Endpoint,
http: [port: 4000],
debug_errors: true,
code_reloader: true,
check_origin: false,
watchers: [npm: ["run", "watch", cd: Path.expand("../assets", __DIR__)]]
{
"repository": {},
"license": "MIT",
"scripts": {
"watch": "cross-env NODE_ENV=development node_modules/webpack/bin/webpack.js --watch --progress --hide-modules --config=node_modules/laravel-mix/setup/webpack.config.js"
},
"devDependencies": {
"phoenix": "file:../deps/phoenix",
"phoenix_html": "file:../deps/phoenix_html",
"axios": "^0.18.0",
"cross-env": "^5.1.4",
"laravel-mix": "^2.1.11",
"lodash": "^4.17.5",
"tailwindcss": "^0.5.2",
"vue": "^2.5.16"
}
}
let mix = require('laravel-mix');
let tailwindcss = require('tailwindcss');
mix.webpackConfig({
resolve: {
symlinks: false,
}
});
mix.setPublicPath('../priv/static')
.js('js/app.js', '../priv/static/js')
.sass('scss/app.scss', '../priv/static/css')
.options({
processCssUrls: false,
postCss: [ tailwindcss('tailwind.js') ],
})
.copyDirectory('./static', '../priv/static');
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment