Skip to content

Instantly share code, notes, and snippets.

@gbonanome
Last active December 15, 2015 16:59
Show Gist options
  • Save gbonanome/5292774 to your computer and use it in GitHub Desktop.
Save gbonanome/5292774 to your computer and use it in GitHub Desktop.
Compile every .less files founded inside a specified folder
#!/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
@gbonanome
Copy link
Author

@gbonanome
Copy link
Author

updated to work also on Mac. Thanks to @nicmart

@gbonanome
Copy link
Author

Obviously you should use grunt for this kind of thing 😄

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment