leshill / handlebars_assets

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

Partial HBS file is not compiled into 'HandlebarsTemplates' variable #163

Closed happyvig closed 6 years ago

happyvig commented 6 years ago

I have a partial HBS file named '_annoucement.hbs' placed inside the 'templates' folder where other HBS files are placed (index.hbs, contact.hbs)

When running the 'rails s' in local, the global HBS namespace variable 'HandlebarsTemplates' doesnot contain the partial file. It only has the other two HBS files.

HandlebarsTemplates['index'], HandlebarsTemplates['contact'] has values.

Appreciate your help.

happyvig commented 6 years ago

Running handlebars_assets version 0.23.2

Chrome console error : _message: "The partial somepartial could not be found"

AlexRiedler commented 6 years ago

@happyvig can you happen to gist the javascript; or look for Handlebars.registerPartial in it; maybe the names do not match as expected?

happyvig commented 6 years ago

Here is what I have observed about partial HBS files behaviour :

The partial HBS files are actually getting compiled, but are not getting listed inside the namespace variable 'HandlebarsTemplates'. They are available inside 'Handlebars.partials.'

Is this the expected behaviour ??

They are getting rendered inside the parent containers properly and they are getting downloaded as separate js files similar to how non-partial HBS files get downloaded as js files, in local dev mode server.

AlexRiedler commented 6 years ago

that is expected behaviour; they get registered as partials inside of Handlebars.

happyvig commented 6 years ago

Thank you.