25.06.2018 Views

Full-Stack Vue.js 2 and Laravel 5

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

<strong>Laravel</strong> Mix<br />

One of the downsides of Webpack is that configuring it is arduous. To make<br />

thing easier, <strong>Laravel</strong> includes a module called Mix that takes the most<br />

commonly-used Webpack options <strong>and</strong> puts them behind a simple API.<br />

The Mix configuration file can be found in the root of the project directory. Mix<br />

configuration involves chaining methods to the mix object that declare the basic<br />

build steps of your app. For example, the <strong>js</strong> method takes two arguments, the<br />

entry file <strong>and</strong> the output directory, <strong>and</strong> the Babel loader is applied by default.<br />

The sass method works in an equivalent way.<br />

webpack.mix.<strong>js</strong>: let mix = require('laravel-mix'); mix.<strong>js</strong>('resources/assets/<strong>js</strong>/app.<strong>js</strong>',<br />

'public/<strong>js</strong>') .sass('resources/assets/sass/app.scss', 'public/css');

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!