lundi 18 février 2019

How can I modify my Ember Addon build based on the template contents?

I'm working on the @fortAwesome/ember-fontawesome addon. I'd like to be able to find the icons that have been used in templates and include the necessary JS into the final build. Template:

I can use

setupPreprocessorRegistry(type, registry) {
  registry.add('htmlbars-ast-plugin', {
    name: 'font-awesome-detect-static-icons',
    plugin: staticIconDetector,
  });
},

This works to discover the icons, but the preprocessors don't do their work until all the other hooks like postprocessTree or treeForVendor have already run. Is there another way to get at the AST of the templates before the other hooks run? Or another way to get at this information?




Aucun commentaire:

Enregistrer un commentaire