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

AST plugins not applied to tagged template strings #307

Closed
dfreeman opened this issue Sep 26, 2019 · 3 comments · Fixed by #309
Closed

AST plugins not applied to tagged template strings #307

dfreeman opened this issue Sep 26, 2019 · 3 comments · Fixed by #309

Comments

@dfreeman
Copy link
Contributor

Opening this here so there's a place to track the issue. This originally came up in Discord in the context of colocated templates (since they're implemented via tagged template strings), but it also applies to templates embedded in JS files directly by users.

AST plugins don't seem to be getting applied to embedded templates. I set up a simple reproduction where the plugin just emits a message to the console when it processes a template. The message is logged for templates that are preprocessed the usual way, but not for those using the hbs tag from ember-cli-htmlbars.

Poking around a little, this seems to be related to the template compiler using global state for configured plugins and the way we have to muck with this state to support different plugins in different contexts, but I wasn't able to come up with a fix in the time I spent playing with it.

@rwjblue
Copy link
Member

rwjblue commented Sep 28, 2019

Still a few TODO items left, but #309 aims to fix this. I confirmed locally, with those changes the plugin in the reproduction is called for the inlined template.

@rwjblue
Copy link
Member

rwjblue commented Sep 30, 2019

@rwjblue
Copy link
Member

rwjblue commented Sep 30, 2019

FYI - I just confirmed in the demo repo with 4.0.2 that the plugin added there does get called. Sent a PR here (only change is bumping ember-cli-htmlbars though): dfreeman/colocated-components-no-template-transforms#1.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
2 participants