Dug.js – A JSONP to HTML Script
11–20 of 20 posts
Re: Dug.js – A JSONP to HTML Script
#12Templating solutions such as Mustache and Handlebars falls short when the need to add intelligence to the template. In such cases, the template needs to extended with helper functions, which leads to scattered templating. Another way to implement smart templates is to use XSLT, which is both standardized as well as longtime proven. XSLT is used commonly used with XML but with DefiantJS, it's trivial to transform JSON…
Re: Dug.js – A JSONP to HTML Script
#13Templating solutions such as Mustache and Handlebars falls short when the need to add intelligence to the template. In such cases, the template needs to extended with helper functions, which leads to scattered templating. Another way to implement smart templates is to use XSLT, which is both standardized as well as longtime proven. XSLT is used commonly used with XML but with DefiantJS, it's trivial to transform JSON…
A typical reason to avoid intelligence in view templates is that it is more difficult to test that logic when it is stored inside the template. Separation of the two improves testability. What are the testing options like for XSLT, are you able to run good automated tests against your templates?
I created http://apidocjs.com and had the problem that i needed some "simple" logic in the templates (handlebars). For such things i must implement a separate view with configuration/data modelling/... and Helper function, but that makes the project-output complex, because i want that the people can change the template as easy as possible. Quick & dirty developed i create many duplicate code in the template to avoid a separate view. It was a silly idea, it makes the template more complex ;-) And only because of some missing logic.
Re: Dug.js – A JSONP to HTML Script
#14Templating solutions such as Mustache and Handlebars falls short when the need to add intelligence to the template. In such cases, the template needs to extended with helper functions, which leads to scattered templating. Another way to implement smart templates is to use XSLT, which is both standardized as well as longtime proven. XSLT is used commonly used with XML but with DefiantJS, it's trivial to transform JSON…
Re: Dug.js – A JSONP to HTML Script
#15Templating solutions such as Mustache and Handlebars falls short when the need to add intelligence to the template. In such cases, the template needs to extended with helper functions, which leads to scattered templating. Another way to implement smart templates is to use XSLT, which is both standardized as well as longtime proven. XSLT is used commonly used with XML but with DefiantJS, it's trivial to transform JSON…
The idea behind Mustache is that your template shouldn't have intelligence. The data passed to the template should be such that it isn't necessary (beyond simple ifs).
Regarding Mustache and Handlebars; the basic idea is that templates should be logic-free - despite this, there are many question at Stackoverflow, on how to add intelligence when using these templating engines. The basic idea and real-life implementation doesn't add up...
Re: Dug.js – A JSONP to HTML Script
#16Re: Dug.js – A JSONP to HTML Script
#17Templating solutions such as Mustache and Handlebars falls short when the need to add intelligence to the template. In such cases, the template needs to extended with helper functions, which leads to scattered templating. Another way to implement smart templates is to use XSLT, which is both standardized as well as longtime proven. XSLT is used commonly used with XML but with DefiantJS, it's trivial to transform JSON…
Re: Dug.js – A JSONP to HTML Script
#18Re: Dug.js – A JSONP to HTML Script
#19Templating solutions such as Mustache and Handlebars falls short when the need to add intelligence to the template. In such cases, the template needs to extended with helper functions, which leads to scattered templating. Another way to implement smart templates is to use XSLT, which is both standardized as well as longtime proven. XSLT is used commonly used with XML but with DefiantJS, it's trivial to transform JSON…
Re: Dug.js – A JSONP to HTML Script
#20
my data is {{data}}
doit('mytemplate', 'http://api.dribbble.com/.../shots')
// or jq plugin
$('#mytemplate').render('http://...');