How does minification of css files using laravel mix work?
As from this laravel-mix issue Jeffrey points out that minification only happens in production mode. So to minify your css files, you can have:
mix.styles([
'public/some.css',
'public/thing.css',
], 'public/css/index.css')
Then running the following will concatenate and minify your files.
$ npm run production
Works for
([email protected])
![shukshin.ivan](https://i.stack.imgur.com/Lehd0.jpg?s=256&g=1)
shukshin.ivan
I LIKE: complicated things, being close to a real business, not just business logic. GROWN UP WITH: physics, light athletics, self-made electronics (simple although) EDUCATED: MIPT, Moscow. Physics and math. Laser physics, biochips and ultrasound non-destructive control. LATEST INTERESTS: microcontrollers, IoT, effectiveness of a business, Laravel LOOKING FORWARD: move to North America and make a business much more successful
Updated on June 14, 2022Comments
-
shukshin.ivan about 2 years
Why does minified file equal to a non-minified?
const { mix } = require('laravel-mix'); mix.styles([ 'public/some.css', 'public/thing.css', ], 'public/css/index.css'); mix.minify('public/css/index.css');
When running
npm run production
, sizes are 128kB (both compressed)Asset Size Chunks Chunk Names mix.js 511 bytes 0 [emitted] mix /css/index.css 128 kB [emitted] /css/index.min.css 128 kB [emitted]
When running
npm run dev
, both files are of the same size and it is160 kB
, i.e. both are non-minified. How come a minified version is dependent not upon amin
suffix, but on a dev\prod option?