Laravel Mix is a clean layer on top of webpack to make the 80% use case laughably simple to execute. Most would agree that, though incredibly powerful, webpack ships with a steep learning curve. But what if you didn't have to worry about that?
Have a look at a basic
let mix = require('laravel-mix'); mix.sass('src/app.sass', 'dist') .js('src/app.js', 'dist');
Done. Simple, right?
- Compile the Sass file,
With this configuration in place, we may trigger webpack from the command line:
During development, it's unnecessary to minify the output, however, this will be performed automatically when you trigger webpack within a production environment:
export NODE_ENV=production webpack.
But what if you prefer Less compilation instead? No problem. Just swap
mix.less(), and you're done!
You'll find that most common webpack tasks become a cinch with Laravel Mix.