Setting up a build process using Node.js, npm, and Laravel Mix
In Chapter 2, Using and Compiling Sass, we already learned how to use Node.js and npm to set up a script that would compile our Sass to CSS. In this setup, we will use Laravel Mix, which is a wrapper around Webpack. In short, Webpack is a module bundler that prepares JavaScript and assets for the browser. By using Laravel Mix, we get a simple API for setting the Webpack configuration without any prior experience with Webpack.
If you haven’t already installed Node.js, then please go back and take a look at Chapter 2 and the Compiling Sass section. Now, here’s a step-by-step guide on how to set up Laravel Mix using Node.js and npm. This will, in the end, generate a package.json
file, a Laravel Mix configuration file, as well as a folder, and some empty files.
Skip setting up Laravel Mix
If you want, you can choose to skip the manual setup of Laravel Mix and simply use the Laravel Mix template provided...