laravel mix webpack is a complete webpack solution of any application. Which is using several common CSS, javascript, pre-processor, and libraries. We will give you some examples like if you went to use a Sass than you need a software or generator to build a CSS file. But you can make it easy for a single line preconfigured setting and you will get a life easier solution. Official Documentation
Important Point Here:
According to laravel mix Install Process .
npm install laravel-mix --save-dev
let mix = require('laravel-mix'); mix.js('assets/src/app.js', './assets/js') .sass('assets/src/app.scss', './assets/css') .setPublicPath('./assets');
Details:
1. mix.js(convert js file), mix.sass(convert sass file into css) and mix.setPublicPath( root path ).
2. Javascript and sass file store assets>src folder. We write a code in this files. When we build it than convert two file as below locations. We write a scss code but build it pure css.
a. assets>js (same name as mix file)
b. assets>css (same name as mix file)
assets under files
// run all mix task 1. npm run dev // run all mix task with minified. 2. npm run production
1. npm install cross-env --save-devAnother need to scripts for your package.json file.
"scripts": { "dev": "npm run development", "development": "cross-env NODE_ENV=development node_modules/webpack/bin/webpack.js --progress --hide-modules --config=node_modules/laravel-mix/setup/webpack.config.js", "watch": "npm run development -- --watch", "hot": "cross-env NODE_ENV=development node_modules/webpack-dev-server/bin/webpack-dev-server.js --inline --hot --config=node_modules/laravel-mix/setup/webpack.config.js", "prod": "npm run production", "production": "cross-env NODE_ENV=production node_modules/webpack/bin/webpack.js --no-progress --hide-modules --config=node_modules/laravel-mix/setup/webpack.config.js" }
mix.styles([ 'assets/css/vendor/bootstrap.css', 'assets/css/vendor/animate.css' ], 'assets/css/all.css');It means all.css file whole data stored. You can visit this link for Details.