SlexAxton / require-handlebars-plugin

A plugin for handlebars in require.js (both in dev and build)
804 stars 202 forks source link

Allow users to configure hbs to use handlebars in an alternate location #238

Closed kworth closed 9 years ago

kworth commented 9 years ago

For apps that currently have handlebars defined in a location other than an hbs directory at the root of the project, this will allow them to ensure that hbs uses the handlebars they need. (example usage below)

The key here is that when you try to bring in handlebars more than once, things seem to become very broken. You either end up with modules using handlebars instance A where the helper was registered on instance B, or the modules are using the shorthand "handlebars" and hbs is using the specified path "hbs/handlebars" and then require.js gets confused. Therefore, this new config option allows a project with many modules already using the shorthand to stay the same, instead of having to change each one of them to start using the same path that hbs is using.

require.config({
    paths: {
        "handlebars": "some/path/to/handlebars" // shorthand
    }
...

Example usage:

"hbs": {
    "handlebarsPath": "handlebars",
    "helperDirectory": "some/path/for/templates/helpers/"
}
SlexAxton commented 9 years ago

Cool cool.

kworth commented 9 years ago

Excellent. When do you expect your next version bump?

SlexAxton commented 9 years ago

Let's do it today? Major bump along with handlebars 3.0 changes?

kworth commented 9 years ago

Sweet!

SlexAxton commented 9 years ago

I ripped all i18n stuff out and shipped it