Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What is the best way to get minified CSS output from LESS?

Tags:

less

minify

Is it possible to get minified compiled CSS from LESS automatically? Every time I change something, I have to manually compress it.

I use less.js to compile LESS.

Thanks.

like image 570
Jay Avatar asked Aug 30 '14 07:08

Jay


2 Answers

$ lessc styles.less -x The compress command has been deprecated.

you'll have to use this command $ lessc -clean-css style.less style.min.css

before use above command you've to install less-plugin-clean-css using below command

$ npm install less-plugin-clean-css -g
like image 51
Hidayt Rahman Avatar answered Nov 17 '22 01:11

Hidayt Rahman


If you are using the Less command-line compiler, you could pass the -x option in order to output minified CSS.

$ lessc styles.less -x

This is documented in Less doc:

To output minified CSS, simply pass the -x option. If you would like more involved minification, the Clean CSS is also available with the --clean-css option.

To see all the command line options run lessc without parameters.

like image 18
Hashem Qolami Avatar answered Nov 17 '22 01:11

Hashem Qolami