ICanHaz.js - template sharing?

Using ICanHaz.js is really nice - it's dead just to create, load and display templates from javascript objects. However, in a somewhat large javascript application, the .htmlfile that launches my application and contains all the ICanHaz templates is really full of template script tags.

So, how should I separate my templates in order to clarify the situation again? Is there an alternative to IcanHaz.js that is better suited for larger projects?

+5
source share
1 answer

Most client template engines have the same concept. You can download the templates remotely using XHR, but this will add the terrible overhead of the HTTP request.

The best alternative would be to create each of them in your own file, and on the server side of the script, merge into your HTML page.

Finally, the final option is to add them built into your javascript rendering functions - this will work for very small templates.

+2
source

All Articles