Using LESS: compile minified and non-minified versions of CSS

Go To StackoverFlow.com

1

Let me start by asking if anyone knows of a compiler like simpLESS or LESS.app that will compile LESS into both a minified and non-minified versions of the CSS? Or has anyone modified either of those programs to save both (one for production and one for development).

Working on a very large website and just now able to implement LESS, which is saving us a bunch of time, but also requires a change in workflow. I was hoping somebody that has gone through something similar will know of a possible solution.

Also, haven't looked at LESSphp... Maybe there's an opportunity there to configure it locally to compile what we want.

Thanks.

2012-04-03 23:09
by cbaone
You can do pretty much what you want with lessphpFelipeAls 2012-04-03 23:17
lessphp doesn't produced the minified version by default, you would have to the minification yourself as the included lessify class will only minify blocks of CSS with one line - cchana 2012-04-04 07:54


3

SimpLESS has a flag that turns off minification by putting //simpless:!minify into the LESS file. You can then easily set up both minified and non-minified by chaining another LESS file. You'll want your files to look like this:

main.min.less

Body{
    color:#000;
}

/*Here goes all your LESS, imports of other LESS files etc*/

main.less

//simpless:!minify
@import "main.less";

Get simpLESS to watch both files. Any changes made will make it recompile both versions. You then get main.css which is not minified and main.min.css which is.

2012-04-11 15:49
by Chao
Ads