Quantcast
Channel: JavaScriptMVC Forum
Viewing all articles
Browse latest Browse all 3491

Re : Conventions, strategy, syntax, file extension for external mustache views/templates?

$
0
0
Do all your work as mustache templates, then load them by relative url. IE: template: can.view.('views/video.mustache')

Then, later on, when you start adding a build process, you can use can.compile to compile your views and pre-load them. When they're preloaded, if done properly, the "id" will be it's relative path, so that if available, pre-loaded views will be used, and as a fallback, they'll be loaded from the server. The trick is that you need to setup your paths such that "views" is including in the pre-loader ids.

In my example, if your templates are in assets/views, and you're building to public/views, then you would set your output paths to public/views.compiled so that "views" is included. Of course, you can also use the path helper as well.

Viewing all articles
Browse latest Browse all 3491

Latest Images

Trending Articles



Latest Images