mix.minify() doesn't minify!
See original GitHub issue- Laravel Mix Version: 1.5.1 (
npm list --depth=0
) - Node Version (
node -v
): 6.11.2 - NPM Version (
npm -v
): 3.10.10 - OS: Windows 10
I just get an index.min.js file that is slightly larger than the ‘unminified’ one.
const {mix} = require('laravel-mix');
mix.js('resources/assets/js/index.js', 'public/js')
.sass('resources/assets/scss/styles.scss','public/css', {
outputStyle: 'compressed'
})
if(process.env.NODE_ENV.trim() === 'production'){
mix.minify('public/js/index.js')
mix.version();
} else {
mix.browserSync({
proxy: 'http://localhost:8000'
});
}
Issue Analytics
- State:
- Created 6 years ago
- Comments:12
Top Results From Across the Web
Concatenation and Minification | Laravel Mix Documentation
If used properly, Laravel Mix and webpack should take care of all the ... Similarly, you may also minify one or more files...
Read more >How does minification of css files using laravel mix work?
When running npm run dev , both files are of the same size and it is 160 kB , i.e. both are non-minified....
Read more >Laravel mix minify but copy un-minified version - Laracasts
Laravel mix minify but copy un-minified version. HI, What I am trying to achieve is minifying a js file and copy the result...
Read more >Compiling Assets (Mix) - The PHP Framework For Web Artisans
Mix provides several features to help you work with your JavaScript files, such as compiling modern ECMAScript, module bundling, minification, and concatenating ...
Read more >laravel-mix-views-minifier - npm
Minify template files with Laravel Mix. Latest version: 2.0.1, last published: 2 years ago. Start using laravel-mix-views-minifier in your ...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Adding to what @rohitbhirud and others have said, my problem was with the
NODE_ENV
not being set properly because of the scripts not being platform independent. I fixed this by using the cross-env package ie within your package.json scripts:First, you don’t need to do that check for production mode.
Minification will only take place during production builds (
npm run production
).