pcardune / handlebars-loader

A handlebars template loader for webpack
557 stars 169 forks source link

Having access to precompiled partials/helpers in runtime #147

Open marciodsousa opened 6 years ago

marciodsousa commented 6 years ago

Hi,

I am at the moment migrating an old-school jQuery+Handlebars webapp to something more modern with the help of Webpack.

What happens is, while some templates can be precompiled (and correctly reference the partials I define) other templates need to be compiled in runtime since their structure comes from an API.

The issue I have is that these templates that I am compiling in runtime have no idea about precompiled partials/helpers.

is there any way to have access to these in runtime? I tried to alias Handlebars to handlebars/runtime, partials and helpers object is then empty.

garrettlancaster commented 4 years ago

I'm also running into this -- trying to use helpers to wrap partials and register them for later javascript instantiation, but Handlebars.partials is empty