linkedin / dustjs

Asynchronous Javascript templating for the browser and server
http://dustjs.com
MIT License
2.91k stars 479 forks source link

Partial Templates not compiling in the Server side (JDK1.6) #390

Closed vedab closed 10 years ago

vedab commented 10 years ago

Error:

java.lang.RuntimeException: sun.org.mozilla.javascript.internal.JavaScriptException: SyntaxError: Expected buffer, comment, partial, reference, section or special but end of input found. At line : 1, column : 1 (dust-full.js#671)

Environment: Server side (JDK1.6)

Root Cause: The callback function of "dust.onLoad" function takes two parameters (1) err, (2) src. The "src" object is arriving to the callback function as "java.lang.String" object, which has "length" as a function and not as a property. Hence the dust-compiler is failing to recognize the template.

Fix: Convert the "src" to JavaScript string object.

Refer: https://github.com/vedab/dustjs/commit/314384350a240b4e15e96d966ff1fb1ee1e0d3f7

jimmyhchan commented 10 years ago

what do you mean by partial templates -- does it fail to compile some templates or all templates? Also, how did you define dust.onLoad? By default, dust.onLoad is undefined and you won't run through the if (dust.onLoad) lines 115-125.

prashn64 commented 10 years ago

Closing due to inactivity. If this is still a problem, please follow up.