I am using handlebars template precompiler for express (https://github.com/diffsky/hbsc) to precompile my templates in nodejs.
It works great when i do it localy but when i try it in cloud9 ide (https://c9.io) it works the first time and then i only get exceptions.
This is my configuration from app.js
var hbsc = require('hbsc');
hbsc.compile({
dir: __dirname + '/views/public',
outfile: __dirname + '/public/javascripts/compiled-templates.js',
extensions: ['hbs', 'handlebars']
});
This is my simple template
<b>All users</b>
<div>
{{#each this}}
<li>{{email}}</li>
{{/each}}
</div>
And this is the exception that i am 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 <
at Module._compile (module.js:437:25)
at Object.Module._extensions..js (module.js:467:10)
at Module.load (module.js:356:32)
at Function.Module._load (module.js:312:12)
at Module.runMain (module.js:492:10)
at process.startup.processNextTick.process._tickCallback (node.js:244:9)
If i remove the compiled template file and try again after a while, it succeeds (sometimes) but if i change a template the error returns.
Again, this code works perfectly when run localy so it looks like that cloud9 handles something differently.
This error really puzzels me since I find no logic in it. Can anybody help me with any insights on where to begin looking to fix this problem?