Last active
August 29, 2015 13:58
-
-
Save STRd6/10400709 to your computer and use it in GitHub Desktop.
Mush templates into JST
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 | |
cd templates | |
for file in *.haml; do | |
hamlet < $file -r "Hamlet" > ${file/.haml}.js | |
done | |
for file in *.js; do | |
echo "(window.JST || (window.JST = {}))['${file/.js}'] = " > tmpfile | |
cat $file >> tmpfile | |
mv tmpfile $file | |
done | |
cat *.js > ../templates.js |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
When run from the root directory of your project, and assuming your templates are in
./templates
and have the.haml
suffix, mu.sh will compile all.haml
files into.js
files, export them on the globalwindow.JST
and concat them into a single./templates.js
file in the root directory of your project.