简体   繁体   中英

ember-cli-htmlbars plugins not processing in-repo addon templates

I'm using a plugin for ember-cli-htmlbars in an addon to process the template ASTs. It works correctly for templates in my addon's dummy application .

However, the dummy application has an in-repo addon that contains templates in addon/templates/ . The in-repo addon specifies ember-cli-htmlbars inside of its package.json , which causes the templates to compile correctly -- with the exception of not being passed through the plugin I have registered in the parent addon. The end result is that in-repo addon templates are not being processed by my plugin, which is ultimately fatal to my addon at runtime.

How can I cause the in-repo addon's templates to also be processed using the ember-cli-htmlbars plugin I specified in my addon?

One way to "fix" this is to also register the same plugin within the in-repo addon itself -- with one special difference. While this works, it feels like the wrong thing to do.

The special difference is that you need to register plugins using this.registry rather than the registry from app or parentAddon inside of the included addon hook. Otherwise, you're just modifying registry of a thing that isn't going to compile your templates.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM