Skip to content

Instantly share code, notes, and snippets.

@alexbaumgertner
Created March 15, 2013 11:33
Show Gist options
  • Save alexbaumgertner/5169270 to your computer and use it in GitHub Desktop.
Save alexbaumgertner/5169270 to your computer and use it in GitHub Desktop.
bem-tools build script, ver 0.1
#!/bin/bash
# put this script to /merged
# depends: npm install cssrb first
# create cssrb config file
BUILD_DIR=`pwd`/build
echo "exports.config = { \
fromBase: '', \
toBase: '${BUILD_DIR}/', \
patterns: { \
'blocks': '../templates/' \
} \
};" > cssrb.js
mkdir -p build/css/ build/js/
cp _merged.js build/js/_merged.js
cp -R img build/img
echo `date` > merged.html
ls ../ | while read line; do
cp ../$line/$line.html build ;
done;
find . -name '_*.css' | while read line; do \
cssrb -c cssrb.js $line build/css/$line -cp; \
done
mv templates build/templates
rm cssrb.js merged.html
@alexbaumgertner
Copy link
Author

ls ../ | while read line; do

replace _line(\S*).css to css/_merged$1.css

replace _line.js to js/_merged.js

replace " to '

cp ../$line/$line.html build ;

done;

@alexbaumgertner
Copy link
Author

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