Created
August 17, 2012 16:07
-
-
Save limptwiglet/3380236 to your computer and use it in GitHub Desktop.
Ember View builder
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
glob.sync(__dirname + '/public/js/templates/**/*.html').forEach(function (file) { | |
var path = file.split('/'); | |
var fileName = path[path.length - 1]; | |
var templateName = fileName.replace('.html', ''); | |
var html = fs.readFileSync(file, 'utf8'); | |
var dest = __dirname + '/public/js/.tmp/' + templateName + '.js'; | |
html = html.replace(new RegExp('"', 'g'), '\\"'); | |
html = html.replace(/[\r\n]/g, ''); | |
html = 'Ember.TEMPLATES["' + templateName+ '"] = Ember.Handlebars.compile(\''+ html +'\');'; | |
// Do what ever you want with the html | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment