0

I'm using Express, connect-assets on an Ember project. I'm stuck with making connect-assets to properly precompile the handlebar templates.

I've configured express like this:

app.use(assets({
  src: app_root + 'app',
  buildDir: './public',
  jsCompilers: {
    hbs: hbsAssets
  }
}));

and with hbsAssets being:

module.exports = {
  match: /\.js$/,
  compileSync: function(sourcePath, source) {
    var match = sourcePath.match(/^.*\/app\/js\/templates\/(.+)\.hbs/)
    , templateName = match[1];

    var filename = path.basename(sourcePath, '.hbs')
    , js = handlebars.precompile(source).toString();

    return 'Ember.TEMPLATES' + '["' + templateName + '"] = Handlebars.template(' + js + ');';
  }
};

The problem is that the only the hbs layouts get rendered, the {{outlet}}s don't get inserted.

Any help would be appreciated

Akshay Rawat
  • 4,714
  • 5
  • 40
  • 65

1 Answers1

1

In the end I ended up using https://npmjs.org/package/ember-template-compiler . It worked out of the box.

Akshay Rawat
  • 4,714
  • 5
  • 40
  • 65