Hi all,
The client option compiles templates with a generic function name of 'template'.
This makes combining a number of these functions into one file a bit difficult.
There are some options for renaming these functions with the grunt/gulp workflow
like
here [0] and
here [1] but these seem heavyweight, where a small change to the jade source could write function names based upon the template filename.
How might a pull request be regarded by the development team that accomplishes
'user.jade' -> 'user.js' with function 'userTemplate'
// lib/jade.js from line 225 or so var trim = function(name) { return filename.replace(/^.*[\\\/]/, '').slice(0, -6); } return 'function ' + trim(filename) + 'Template(locals) {\n' + fn + '\n}';There are more elegant solutions using the path library, but a solution without an extra dependency might be preferred.
I'd welcome any comments or suggestions,
Cheers, Gavin.
[0]
http://stackoverflow.com/questions/22234869/compile-client-side-jade-templates-using-gulpjs[1]
http://programanddesign.com/php/compile-all-jade-files-to-a-single-client-side-javascript-file/