javascript - Handlebars precompilation via nodejs fails on Cloud9 -


i using handlebars template precompiler express (https://github.com/diffsky/hbsc) precompile templates in nodejs.

it works great when localy when try in cloud9 ide (https://c9.io) works first time , exceptions.

this configuration app.js

var hbsc = require('hbsc');     hbsc.compile({       dir: __dirname + '/views/public',       outfile: __dirname + '/public/javascripts/compiled-templates.js',       extensions: ['hbs', 'handlebars']     }); 

this simple template

<b>all users</b>  <div>     {{#each this}}     <li>{{email}}</li>     {{/each}} </div> 

and exception getting

/var/lib/stickshift/5168822b4382ec505c0000ba/app-root/data/471704/views/public/listusers.handlebars:1 (function (exports, require, module, __filename, __dirname) { <b>all users</b>                                   ^ syntaxerror: unexpected token <     @ module._compile (module.js:437:25)     @ object.module._extensions..js (module.js:467:10)     @ module.load (module.js:356:32)     @ function.module._load (module.js:312:12)     @ module.runmain (module.js:492:10)     @ process.startup.processnexttick.process._tickcallback (node.js:244:9) 

if remove compiled template file , try again after while, succeeds (sometimes) if change template error returns.

again, code works when run localy looks cloud9 handles differently.

this error puzzels me since find no logic in it. can me insights on begin looking fix problem?

it conflict between handlebars templates server , ones on client. using express3-handlebars compile templates server , error came compiler, not client-based one.

my solution rename client templates .html instead. way 2 compilers seems along.

i still can't explain why never got same error on local nodejs installation though.


Comments

Popular posts from this blog

c# - Send Image in Json : 400 Bad request -

jquery - Fancybox - apply a function to several elements -

An easy way to program an Android keyboard layout app -