Closed daslicht closed 9 years ago
If you are using Browserify it'd recommend that you install either https://www.npmjs.com/package/stringify or https://www.npmjs.com/package/browserify-plain-jade and just do something like this:
var element = $(require('./myTemplate.html'));
element.render(data, directives);
$('#somewhere').prepend(element);
If I couldn't use browserify, I would probably use hidden templates in my html-files.
In conclusion I'd say that the best way of doing this is definitely with a module loader like browserify or webpack.
Thank you for the reply !
How would you handle templates for items which you render at runtime? Do you place the item template inline and just make it invisible ? Or is there a better way?