-
Notifications
You must be signed in to change notification settings - Fork 10
Description
Setup
In your package json have two different packages which both depend on clayhandlebars (for example amphora-html and amphora-amp) and within each of those packages have something like the following:
var clayhandlebars = require('clayhandlebars'),
hbsEnvironment = clayhandlebars();Expected Result
The two packages should have non-conflicting hbsEnvironments, i.e that hbsEnvironment in both packages should be a separate Handlebars environment
Actual Result
Both packages have the same hsbEnvironment meaning they can potentially conflict when defining partials or helpers. I believe this is due to the fact that clayhandlebars will define the environment by just requiring the handlebars package (which will get cached by require). This causes an issue if the two packages intend to add partials of the same name
Possible Resolution
One possible resolution I think would be to make a slight modification to the way the environment is created. In the initialization method change the handlebars initialization to use create so that it always produces a no-conflict handlebars environment to use.