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:
I just made the script on top of @iloveitaly's work:
#!/bin/bash
# file name: lesscdir
if [[ -z $1 || -z $2 ]];then
echo 'both arguments are needed'
exit
fi
find $1 -name '*.less' -printf '%P\n' | while read name; do
FROM=$(echo $1'/'$name)
TO=$(echo $2'/'$name | sed "s|\.less|\.css|")
TO_DIRNAME=$(dirname $TO)
if [ ! -e $TO_DIRNAME ];then
mkdir -p $TO_DIRNAME
fi
echo 'Compiling' $FROM '->' $TO
lessc $FROM $TO
done
and then:
$ chmod +x lesscdir
$ sudo ln -s $(readlink -f lesscdir) /usr/local/bin/
Although I like python the best and solve most problems with it, it's still very happy to use bash in linux environment.