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

Unable to deactivate the theme resources in order to add some custom Handlebars helpers #864

Closed
Aleksandyr opened this issue Oct 2, 2018 · 0 comments

Comments

@Aleksandyr
Copy link
Contributor

Aleksandyr commented Oct 2, 2018

I would like to ask whether you have an approach of adding new Handlebars helpers within external plugins?
I have noticed that in order to register some new theme resource you firstly need to deactivate them. So I tried it but without any success because the deactivation was not full. More specifically I have noticed in your helper.ts within the HelperStack class that activate and deactivate methods have same if statement which prevents deactivation at the most abstract level which is within the ResourceStack class.

I suppose that here you should have been invoking the deactivate method of the abstract ResourceStack class. Which leads to the following code

if (!super.deactivate())

Please notify me if I'm wrong!

my source:

this.application.renderer.theme.resources.deactivate();
this.application.renderer.theme.resources.helpers.addOrigin('custom-helper', `<path-to-my-custom-helper-function>`));
this.application.renderer.theme.resources.activate();

Although if you have any suggestions of how I could add additional Handlebars helpers through my external plugin it would be great!

Here you can find our Localization plugin.

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

1 participant