shekhardesigner shekhardesigner - 2 months ago 5x
Less Question

What is the difference between compress and cleancss options in grunt-contrib-less?


I am using grunt-contrib-less for compiling all less files. I found two options doing the same for me.

compress: true


cleancss: true

What is the difference between these two options? Anything I am missing? Should I be using both or just any?


You can't use both, as the docs tell you compress Compress output by removing some whitespaces. If you would like more involved minification you should use the Clean CSS option. compress option are built in the Less compiler and clean-css are separate package.

Currently the Clean CSS option also strips (or does not insert) the /*# sourceMappingURL= comment., see:

The Less compiler also has the possibility to pass an option to clean css with clean-option grunt-contrib-less does not seems to support this option.