Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Laravel Elixir: How to minify files?

I want to use Laravel Elixir to minify my css/files files. But I don't want to use the mix-methode and merge them. All I want is to generate a "custom.min.js" file from my original "custom.js". Is there a way to do this with Elexir?

EDIT: To make it a bit clearer: My biggest issue is that I have two folders in "resources/assets": js and css. So I basically want to minify all files in there and have them minified in "public/js" and "public/css".

like image 305
LuMa Avatar asked May 14 '15 11:05

LuMa


2 Answers

Quote from the Laravel documentation:

Note: All tasks will assume a development environment, and will exclude minification. For production, use gulp --production.

This means if you want the files to be minified run gulp --production instead of just gulp. It's a better practise than enabling compression directly in the gulp file and makes sure you can debug your compiled files while developing the application.

If you want them to be placed in public/assets/css use the path as a second parameter:

mix.less('app.less', 'public/assets/css');
like image 63
Kevin Woblick Avatar answered Oct 23 '22 05:10

Kevin Woblick


gulp --production.

Jeffrey way replied on the issue here: https://laracasts.com/discuss/channels/elixir/elixir-doesnt-minify

Or you can find it on the documentation. Enjoy coding!

like image 4
Kuya A Avatar answered Oct 23 '22 04:10

Kuya A