grunt-emberify
Advanced tools
Comparing version 0.1.7 to 0.1.8
{ | ||
"name": "grunt-emberify", | ||
"description": "Precompile handlebars templates and concatenate all Ember files.", | ||
"version": "0.1.7", | ||
"version": "0.1.8", | ||
"homepage": "https://github.com/gyllstromk/grunt-emberify", | ||
@@ -24,3 +24,5 @@ "author": { | ||
"main": "grunt.js", | ||
"bin": "bin/grunt-emberify", | ||
"bin": { | ||
"grunt-emberify": "bin/grunt-emberify" | ||
}, | ||
"engines": { | ||
@@ -27,0 +29,0 @@ "node": "*" |
@@ -15,6 +15,6 @@ /* | ||
grunt.registerMultiTask('handlebars', 'Precompile Handlebars templates', function() { | ||
function render(self, compiler, templateFormat) { | ||
var templates = {}; | ||
grunt.file.expandFiles(this.file.src).forEach(function(each) { | ||
grunt.file.expandFiles(self.file.src).forEach(function(each) { | ||
var templateName = path.basename(each, path.extname(each)); | ||
@@ -26,16 +26,26 @@ if (templateName in templates) { | ||
templates[templateName] = | ||
Handlebars.precompile(grunt.file.read(each)).toString(); | ||
templates[templateName] = compiler(grunt.file.read(each).toString()); | ||
}); | ||
grunt.file.write(this.target, grunt.utils._.keys(templates).map(function(templateName) { | ||
grunt.file.write(self.target, grunt.utils._.keys(templates).map(function(templateName) { | ||
// grunt underscore library is old. should use `pairs` | ||
return util.format('Ember.TEMPLATES[\'%s\'] = ' + | ||
'Ember.Handlebars.template(%s);', templateName, | ||
templates[templateName]); | ||
templateFormat, templateName, templates[templateName]); | ||
}).join('\n')); | ||
this.async()(); | ||
self.async()(); | ||
} | ||
grunt.registerMultiTask('handlebars_embed', 'Precompile Handlebars templates', function() { | ||
render(this, function(each) { | ||
return each.replace(/"/g, '\\"').replace(/\n/g, ' '); | ||
}, 'Ember.Handlebars.compile("%s");'); | ||
}); | ||
grunt.registerMultiTask('handlebars_precompile', 'Embed Handlebars templates', function() { | ||
render(this, function(each) { | ||
return Handlebars.precompile(each); | ||
}, 'Ember.Handlebars.template(%s);'); | ||
}); | ||
}; |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
6202
106