simonblee / marionette-dust Goto Github PK
View Code? Open in Web Editor NEWDustJS templates for Marionette
DustJS templates for Marionette
Hi simon, AFAIK dustjs renders asynchronously, so the following code will result in a race condition especially if the template is complex. Have you encountered such a problem? Thanks.
var html;
// Template must be compiled and in the dust cache. Recommend pre-compiling
// and loading the templates as scripts at app start.
dust.render(template, data, function (err, out) {
html = out;
});
return html;
Errors when installing with bower:
bower marionette-dust#0.3.1 extract archive.tar.gz
bower marionette-dust#0.3.1 mismatch Version declared in the json (0.1.6) is different than the resolved one (0.3.1)
bower marionette-dust#0.3.1 invalid-meta backbone.marionette.dust is missing "ignore" entry in bower.json
Hi,
The render function return an asynchronous value, wouldn't html returned as undefined???
Backbone.Marionette.Renderer.render = function (template, data) {
var html;
dust.render(template, data, function (err, out) {
html = out;
});
return html;
};
Hello Simon - thanks for this and your Maryo generator, it's great to see somebody integrating Dust.js with Marionette!
I can't seem to get the dust templates to load based on your sample, but I'm a super noob to Marionette, so surely that's the problem. Could you possibly post a simple working example of loading a non AMD compiled template into a Marionette view of some kind?
thanks in advance :)
This plugin breaks "template function" feature, see in docs http://marionettejs.com/docs/v2.4.1/marionette.itemview.html#itemview-render
For my projects, I've added a line in the beginning to fix this:
Backbone.Marionette.Renderer.render = function (template, data) {
template = _.isFunction(template) ? template(data) : template;
...
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.