grunt-ember-handlebars
grunt-ember-handlebars copied to clipboard
support for compiling ember components
Allows you to specify a componentsRegEx that'll prefix components with 'components/' in the template name so they can be used as Ember Components.
I think I might of have some sort of auto convert tabs to spaces that makes the change bigger than it really is. Most of it is just a change from a conditional that switched between a partial and a normal template to a if/else if/else block that also support components.
//process var name/namespace of template.
+ if (isPartial.test(_.last(filepath.split('/'))) ) {
+ filename = processPartialName(filepath);
+ templates.push(nsInfo.namespace+'['+JSON.stringify(filename)+'] = '+compiled+';');
+ } else if(isComponent.test(filepath)){
+ filename = processName(filepath);
+ templates.push(nsInfo.namespace + "[" + JSON.stringify( 'components/' + filename)+"] = " +compiled+';');
+ } else {
+ filename = processName(filepath);
+ templates.push(nsInfo.namespace +'['+JSON.stringify(filename)+'] = '+compiled+';');
+ }