It's a nice fun little tool -- but it's rather inefficient in terms of the number of AJAX requests that it needs to do in order to fetch the templates. The rather simple linked page needs a total of 3 AJAX requests, one for each template. As your app (especially mobile apps) needs more templates, it probably won't be very performant. There's a reason why Ember and other frameworks prefer their templates to be embedde…
Default behavior for ngView in Angular is to fetch the template with Ajax. You have your view html files in a partials directory.
Fragment.js - A tiny tool for loading html fragments and templates
11–14 of 14 posts
Re: Fragment.js - A tiny tool for loading html fragments and templates
#12If you added a build process that actually pulled in the source files for a bundled production file you might have something similar to RequireJS for templates. Cool stuff.
Doesn't require.js include plugins that will pull in compiled templates for you for the major templating libraries already? (underscore, mustache etc)?
Re: Fragment.js - A tiny tool for loading html fragments and templates
#13Earlier quoted context omitted.
Doesn't require.js include plugins that will pull in compiled templates for you for the major templating libraries already? (underscore, mustache etc)?
Yes it does. This one precompiles handlebars for you: https://github.com/SlexAxton/require-handlebars-plugin
Re: Fragment.js - A tiny tool for loading html fragments and templates
#14Earlier quoted context omitted.
Yes it does. This one precompiles handlebars for you: https://github.com/SlexAxton/require-handlebars-plugin
That's pretty sweet. So if you run the r.js optimizer, you'll be serving minified, precompiled templates to the client.