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

CommonJS auto-require Handlebars #89

Open
nicovalencia opened this issue Jan 16, 2014 · 2 comments
Open

CommonJS auto-require Handlebars #89

nicovalencia opened this issue Jan 16, 2014 · 2 comments

Comments

@nicovalencia
Copy link

Is there a reason for not having an auto-require option for Handlebars when using the CommonJS compiled version?

For example:

options: {
  namespace: false,
  commonjs: true,
  require: 'handlebars'
}

This would add a var Handlebars = require('handlebars'); to the compiled template module, so the user doesn't have to require and passthrough the Handlebars library in every module that needs templates.

Current usage:

var Handlebars = require('handlebars');
var Templates = require('./templates')(Handlebars);

Proposed change would allow:

var Templates = require('./templates');

Am I missing something, or would this have a decent use case? I'd be happy to contribute, just wanted to make sure I'm not missing something that already exists.

@dwick
Copy link

dwick commented Jan 27, 2014

+1

This should be a default behavior for commonjs. I'd argue that an option is unnecessary (namespace should probably also default to false for commonjs too).

@dwick
Copy link

dwick commented Jan 27, 2014

Sent a pull request #91.

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

2 participants