{"id":3303,"date":"2014-03-21T20:24:21","date_gmt":"2014-03-21T20:24:21","guid":{"rendered":"https:\/\/unknownerror.org\/index.php\/2014\/03\/21\/problem-about-dust-js-collection-of-common-programming-errors\/"},"modified":"2014-03-21T20:24:21","modified_gmt":"2014-03-21T20:24:21","slug":"problem-about-dust-js-collection-of-common-programming-errors","status":"publish","type":"post","link":"https:\/\/unknownerror.org\/index.php\/2014\/03\/21\/problem-about-dust-js-collection-of-common-programming-errors\/","title":{"rendered":"problem about dust.js-Collection of common programming errors"},"content":{"rendered":"<ul>\n<li><img decoding=\"async\" src=\"http:\/\/www.gravatar.com\/avatar\/a1836a522950d64cd335f509865548a0?s=32&amp;d=identicon&amp;r=PG\" \/><br \/>\nAVP<br \/>\nhtml web jade dust.js<br \/>\nI&#8217;ve been looking all over for something that will let me precompile static websites using Grunt. It needs to have partials, so I can include things like a common header\/footer across the pages.So far, I&#8217;ve only really found Jade, which has a grunt plugin, and this plugin for Grunt that compiles Dust.js templates to static HTML. I don&#8217;t really like Jade&#8217;s syntax, and the Dust plugin for Grunt is less than ideal. Any suggestions for a good static HTML templating language with Grunt support?<\/li>\n<li><img decoding=\"async\" src=\"http:\/\/i.stack.imgur.com\/6bHP9.png?s=32&amp;g=1\" \/><br \/>\nergoon<br \/>\njavascript node.js mongodb mongoose dust.js<br \/>\nI have a dust.js template that should render a JSON object coming from a mongodb collection.{&#8220;author&#8221;: &#8220;Leslie Horn&#8221;,&#8221;title&#8221;: &#8220;An Awesome 132-Cube Ice Tray Exists Because People Are Assholes&#8221;,&#8221;published&#8221;: &#8220;2013-06-13T21:00:00.000Z&#8221;,&#8221;link&#8221;: &#8220;http:\/\/gizmodo.com\/an-awesome-132-cube-ice-tray-exists-because-people-are-513229668&#8243;,&#8221;feed&#8221;: {&#8220;link&#8221;: {&#8220;xml&#8221;: &#8220;feed\/http:\/\/feeds.gawker.com\/gizmodo\/excerpts.xml&#8221;,&#8221;html&#8221;: &#8220;http:\/\/gizmodo.com&#8221;},&#8221;title&#8221;: &#8220;Gizmodo&#8221;},&#8221;summary&#8221;: &#8220;&lt;p&gt;&lt;img alt=\\&#8221;An Awesome 1<\/li>\n<li><img decoding=\"async\" src=\"http:\/\/www.gravatar.com\/avatar\/45dae809c665a65f8561fccf6ad42898?s=32&amp;d=identicon&amp;r=PG\" \/><br \/>\nElankeeran<br \/>\nnode.js express dust.js<br \/>\nIn expressjs, Dustjs Multiple templates not working getting 500 Error: Template Not Found: templatemy base dust template as below (template.dust)&lt;div class=&#8221;page&#8221;&gt;{+pageHeader}Hello World!{\/pageHeader}&lt;div class=&#8221;bodyContent&#8221;&gt;{+bodyContent\/}&lt;\/div&gt;&lt;div class=&#8221;footer&#8221;&gt;{+pageFooter}&lt;hr&gt;&lt;a href=&#8221;\/contactUs&#8221;&gt;Contact Us&lt;\/a&gt;{\/pageFooter}&lt;\/div&gt; &lt;\/div&gt;And I am trying to call this base template inside my home.dust I am getting error as belowExpress 500<\/li>\n<li><img decoding=\"async\" src=\"http:\/\/i.stack.imgur.com\/nZEUQ.png?s=32&amp;g=1\" \/><br \/>\nPeeHaa<br \/>\nphp jquery dust.js<br \/>\nCurrent I did the dustjs in client javascript as below&lt;!DOCTYPE html&gt; &lt;html&gt; &lt;head&gt;&lt;script src=&#8221;lib\/dust-full-0.3.0.min.js&#8221; type=&#8221;text\/javascript&#8221;&gt;&lt;\/script&gt;&lt;script src=&#8221;vendor\/jquery-1.7.1.min.js&#8221; type=&#8221;text\/javascript&#8221;&gt;&lt;\/script&gt;&lt;script type=&#8221;text\/javascript&#8221;&gt;$(document).ready(function(){\/\/ JSON response from server var json_object = { &#8220;profile_skill&#8221;: &#8220;Profile Skill&#8221;,&#8221;skills&#8221;: [{ &#8220;name&#8221;: &#8220;JavaScript&#8221; },{ &#8220;name&#8221;: &#8220;Ruby&#8221; },{ &#8220;name&#8221;: &#8220;Java&#8221; }]}\/\/ re<\/li>\n<li><img decoding=\"async\" src=\"http:\/\/www.gravatar.com\/avatar\/56533d50fdfceb887852bf50be54678b?s=32&amp;d=identicon&amp;r=PG\" \/><br \/>\nnalply<br \/>\nhtml dust.js<br \/>\nThe partials were used in the this way but I was getting output as undefined. Created two template files parent and child that inherits from parent.parent.tl:&lt;div&gt;&lt;span&gt;&lt;label&gt;{+title}New{\/title}&lt;\/label&gt;&lt;\/div&gt;child.tl:{&gt;&#8221;parent&#8221;\/}{&lt;title}{#t}&lt;p&gt;NEW {title1} For the Child&lt;\/p&gt;{\/t} {\/title}I compiled those templates using dustr and included as .js in my HTML.&lt;script src=&#8221;https:\/\/raw.github.com\/akdubya\/dustjs\/master\/dist\/dust-full-0.3.0.min.js&#8221;&amp;g<\/li>\n<li><img decoding=\"async\" src=\"http:\/\/www.gravatar.com\/avatar\/bfad81ce3faaa9c12b5cd04eba23cca5?s=32&amp;d=identicon&amp;r=PG\" \/><br \/>\ngodspeed<br \/>\ndust.js<br \/>\nI&#8217;ve just started using dust.js. And I&#8217;ve come across a problem. I need to specify a condition (json parameters existence) in template. Depending on it some inner html should be rendered or not. So according to the description I should use smth like this:{?param_name} &#8230; {:else} {\/param_name}But I need to check a complex condition, so I go for logic helper &#8211; {@if..}. And it turns out that I&#8217;d like to use path in condition. So.. The result looks:{@if cond=&#8221;{myObject.property1} || {myObject.prope<\/li>\n<li><img decoding=\"async\" src=\"http:\/\/www.gravatar.com\/avatar\/0a9380f35d52fd24ae753a1186878b55?s=32&amp;d=identicon&amp;r=PG\" \/><br \/>\nKevin Leary Boston WordPress<br \/>\njavascript jquery asp.net-mvc json dust.js<br \/>\nI&#8217;m working with jQuery 1.8.2 &amp; Dust.js v1.1.1 for MVC-style templating within a JavaScript app. When I use the {@gt} logic helper I receive the following console error:Uncaught TypeError: Cannot read property &#8216;gt&#8217; of undefinedI believe the proper syntax is used in my template:&lt;ul class=&#8221;listview&#8221;&gt; {#seasons}&lt;li&gt;&lt;h3&gt;{name}&lt;\/h3&gt;&lt;p class=&#8221;desc&#8221;&gt;{id}&lt;\/p&gt;{@gt key=&#8221;months&#8221; value=&#8221;0&#8243;}&lt;span class=&#8221;count&#8221;&gt;{months}&lt;\/span&gt;{\/gt}&lt;\/li&gt; {\/seasons} &lt;<\/li>\n<li><img decoding=\"async\" src=\"http:\/\/www.gravatar.com\/avatar\/639ced0d6d8b40ff2472650a8e349145?s=32&amp;d=identicon&amp;r=PG\" \/><br \/>\nJim<br \/>\njavascript dust.js<br \/>\nI&#8217;m using the full, Linked In version 1.2.0 of dust.js and am trying to define a filter for use when rendering a JSON view with a dust template. When I include this line in the page script:_.extend(dust.filters, {foo: function(value){ return &#8216;foo&#8217;; }});it results in this error in Chrome&#8217;s debugger:Uncaught ReferenceError: _ is not defined If I add the filter definition to where the other filters are in the dust .js file, it works. What am I doing wrong?<\/li>\n<li><img decoding=\"async\" src=\"http:\/\/www.gravatar.com\/avatar\/639ced0d6d8b40ff2472650a8e349145?s=32&amp;d=identicon&amp;r=PG\" \/><br \/>\nJim<br \/>\njavascript dust.js<br \/>\nI&#8217;m trying to render HTML using compiled templates with dust.js in a browser (not server-side with node.js). If I compile the template in the client-side javascript, it works fine. If I pre-compile the template and include it as a script tag as recommended, the dust.loadSource statement results in the Chrome debugger saying: &#8220;Uncaught ReferenceError: nowork is not defined&#8221;, where &#8220;nowork&#8221; is the template name. So&#8230;This HTML and script works:&lt;!DOCTYPE html&gt; &lt;html lang=&#8221;en&#8221;&gt; &lt;head&amp;<\/li>\n<\/ul>\n<p>Web site is in building<\/p>\n","protected":false},"excerpt":{"rendered":"<p>AVP html web jade dust.js I&#8217;ve been looking all over for something that will let me precompile static websites using Grunt. It needs to have partials, so I can include things like a common header\/footer across the pages.So far, I&#8217;ve only really found Jade, which has a grunt plugin, and this plugin for Grunt that [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[],"class_list":["post-3303","post","type-post","status-publish","format-standard","hentry","category-uncategorized"],"_links":{"self":[{"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/posts\/3303","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/comments?post=3303"}],"version-history":[{"count":0,"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/posts\/3303\/revisions"}],"wp:attachment":[{"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/media?parent=3303"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/categories?post=3303"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/tags?post=3303"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}