leshill / handlebars_assets

Use handlebars.js templates with the Rails asset pipeline.
MIT License
647 stars 159 forks source link

It only works if application.js is included in the source #100

Closed pjurczynski closed 5 years ago

pjurczynski commented 10 years ago

Context:

Result:

AlexRiedler commented 10 years ago

Just to verify, have you followed: https://github.com/leshill/handlebars_assets#javascript-setup ?

pjurczynski commented 10 years ago

yes. I had everything setup, but my main file was called refactor.js.coffee. Then after I renamed it to application.js.coffee, everything started to work.

In development environment everything works fine in both cases. On my staging server it is not (the main difference is precompilation of assets)

AlexRiedler commented 10 years ago

I have been trying to replicate, tried rails 3.1, 3.2, 4.0, 4.1 ... still can't happen I always get this:

(function() {
  this.HandlebarsTemplates || (this.HandlebarsTemplates = {});
  this.HandlebarsTemplates["hello_world"] = Handlebars.template(function (Handlebars,depth0,helpers,partials,data) {
  this.compilerInfo = [4,'>= 1.0.0'];
helpers = this.merge(helpers, Handlebars.helpers); data = data || {};
  var buffer = "", stack1, helper, functionType="function", escapeExpression=this.escapeExpression;

  if (helper = helpers.name) { stack1 = helper.call(depth0, {hash:{},data:data}); }
  else { helper = (depth0 && depth0.name); stack1 = typeof helper === functionType ? helper.call(depth0, {hash:{},data:data}) : helper; }
  buffer += escapeExpression(stack1)
    + " is awesome.";
  return buffer;
  });
  return this.HandlebarsTemplates["hello_world"];
}).call(this);

@pjurczynski maybe you can provide more details ? rails version, gem versions ?

pjurczynski commented 5 years ago

Wow... I'm truly sorry for making you waste the time on such an undocumented issue report. I guess nobody had encountered the same issue. I'll let myself close the issue 5 years later.

Cheers man :).