I have a directory full of less css files. What is the best way to compile them to normal css? (for deployment)
Id like to run a command as follows:
If you want compile multiple less files into multiple css files try this one-liner bash script:
for file in *.less; do lessc -x --yui-compress -O2 --strict-imports $file `basename $file`.css ; done
You will get a list of .less.css files after run the command.
PS: It addittionaly optimizes (-O2) at maximum, compress (-x) and minifies with YUI Compressor (--yui-compress) with strict import evaluation (--strict-imports).
EDITED: For new YUI Compressor versions skip -02 and --yui-compress deprecated, so:
for file in *.less; do lessc -x --strict-imports $file `basename $file`.css ; done