You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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:
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.
The text was updated successfully, but these errors were encountered:
I like this idea, but I'm worried about how different packages are using handlebars (I know kiln has to do some weird stuff to mimic using the same hbs environment / helpers / partials as amphora-html)
In the interim time I could utilize the env override here and pass in my own handlebars environment in amphora-amp so that it does not utilize the root one. Is that what you'd recommend for now?
Setup
In your package json have two different packages which both depend on
clayhandlebars
(for exampleamphora-html
andamphora-amp
) and within each of those packages have something like the following:Expected Result
The two packages should have non-conflicting hbsEnvironments, i.e that
hbsEnvironment
in both packages should be a separate Handlebars environmentActual 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 namePossible 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.
The text was updated successfully, but these errors were encountered: