Last active
December 15, 2015 16:59
-
-
Save gbonanome/5292774 to your computer and use it in GitHub Desktop.
Compile every .less files founded inside a specified folder
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# file name: lesscdir | |
# Compile every .less found under a specified folder | |
# $1 is the folder to search | |
# $2 allows to use a lessc parameters for compiling | |
if [[ -z $1 ]];then | |
echo 'Specify a directory to search' | |
exit | |
fi | |
find $1 -name '*.less' -print | while read name; do | |
FROM=$name | |
TO=$(echo $name | sed "s|\.less|\.css|") | |
echo 'Compiling' $FROM '->' $TO | |
lessc $2 $FROM $TO | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
updated to work also on Mac. Thanks to @nicmart