I am searching for the javascript template engine which ships with the precompilation script + watcher. How would I see it:
- You write the files as the typical html layouts and store in let's say the files of the .mustache type
- You run a watcher in the console, which watches the change开发者_如何学Pythons in the files and compiles them to .js files where the template is treated like a function, which performs the string concatenation and embeds the variables' values.
- This files are the used in the application.
This mechanism would solve a cross-domain issue in loading files of the non-js type, as well that it would be easy to merge them into one file for the performance reasons.
From the research I've made only the handlebars.js is promising to ship this feature in future. Would be happy to know if anyone else has implemented this?
You can try this solution for client javascript templates https://github.com/kupriyanenko/jsttojs
https://github.com/visionmedia/jade this takes about no time to learn and does everything you want.
精彩评论