Partials in a subdirectory don't compile correctly #9

Merged
merged 2 commits into from May 2, 2012
Jump to file or symbol
Failed to load files and symbols.
+6 −4
Split
@@ -1,2 +1,3 @@
{{>sample}}
{{>plain}}
+{{>subfolder/subsub/_sample}}
@@ -0,0 +1 @@
+<h1>This is a partial in a subdirectory</h1>
@@ -28,9 +28,9 @@ module.exports = function( options, nm, file_contents ){
// delete any cached versions of the template
compiled_hbs = handlebars.precompile( file_contents );
- output = nm.slice(0,1) == '_' ?
+ output = Path.basename(nm).slice(0,1) == '_' ?
[
- 'Handlebars.registerPartial("'+ nm.slice( 1, nm.length ) +'", ',
+ 'Handlebars.registerPartial("'+ nm.replace(/\//g, ".") +'", ',
'Handlebars.template('+ compiled_hbs +'));\n'
] : [
options.namespace + '["'+ nm +'"] = function(context) { return HandlebarsTemplates["'+ nm +'"](context); };',
View
@@ -78,7 +78,7 @@ vows.describe('Test universal JST').addBatch({
}, this.callback)
},
'Then an array is returned': function(arr){
- assert.equal(arr.length, 10);
+ assert.equal(arr.length, 11);
},
'Then the templates are valid': function(arr){
var str = arr.join('\n');
@@ -99,9 +99,9 @@ vows.describe('Test universal JST').addBatch({
}]
};
assert.include(window.JST.helpers(context), '<h1>By Alan Johnson</h1>');
-
assert.include(window.JST.partials({ title: 'hello'}), '<h1>hello</h1>');
assert.include(window.JST.partials({ title: 'hello'}), 'This is a plain template');
+ assert.include(window.JST.partials({ title: 'hello'}), 'This is a partial in a subdirectory');
}
},
'when compiling jquery tmpl jst': {