Last Updated: February 25, 2016
·
2.017K
· tylerlee

bulk sass-convert

Used this to run sass-convert over a folder of scss files and bring them to the indented syntax

for file in `ls *.scss`; 
do 
  n="$(echo $file | sed 's/^\(.*\).scss$/\1.sass/')"; 
  sass-convert $file $n; 
  rm $file;
done

2 Responses
Add your response

If you want to find all files within the folder structure you are currently at (i.e. all files within subfolders) and convert them all, you can do this:

for file in $(find ./ -name ".sass"); do n="$(echo $file | sed 's/^(.).sass$/\1.scss/')"; sass-convert $file $n; rm $file; done

Please note that this will find and convert sass to scss (because that is what I wanted to do) so to convert the other way round you just change all sass to scss and vice versa.

Cheers!

over 1 year ago ·

The sed pattern fails due to unescaped braces. I ended up with this:

for file in $(find ./ -name "*.scss");
do n="$(echo $file | sed 's/.scss$/.sass/')";
  sass-convert $file $n;
  rm $file;
done
over 1 year ago ·