Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Two handlebars instances created #1

Open
AndiDog opened this issue Feb 22, 2014 · 3 comments
Open

Two handlebars instances created #1

AndiDog opened this issue Feb 22, 2014 · 3 comments

Comments

@AndiDog
Copy link

AndiDog commented Feb 22, 2014

Originally posted this issue here.

In the attached minimal project (using grunt and browserify-handlebars), two instances of handlebars are created

  1. from 'node_modules\handlebars\Lib\index.js'
  2. from 'node_modules\handlebars\Dist\Cjs\handlebars.js'

I think the reason is the alias 'dist/cjs/handlebars', but not sure. Of course I want only one default instance on which I can register my helpers globally. How would I resolve this ambiguity?

https://www.dropbox.com/sh/spn8du2g5pn4xt7/sGZFWWDWRA

@AsaAyers
Copy link

Here is a gist with a slightly modified version of the above project so you don't have to download a 25MB zip.

https://gist.github.com/AsaAyers/9172448

git clone https://gist.github.com/9172448.git
cd 9172448
npm install
npm test

You'll see that it throws Missing helper: 'list' even though it's defined here in main.coffee.

@AsaAyers
Copy link

As a work around I did find that if I replace

hbs = require('handlebars')

with

hbs = require('handlebars/runtime').default

it will register and use the helper.

@geekytime
Copy link

As a work around I did find that if I replace

hbs = require('handlebars')
with

hbs = require('handlebars/runtime').default
it will register and use the helper.

Thanks for the workaround. This would be a helpful addition to the documentation for anyone who uses helpers.

@justinmc justinmc mentioned this issue Nov 12, 2014
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants