我试图插入编译步骤并修改 AST 以修正 DOM 元素的数据属性( HTML 模板)。
这是在不修改源代码的情况下将信息输入 DOM 编译时间输入 DOM 。 想法是每次项目为注入而建立时, 将预处理器作为建设步骤运行 。
角有正式的预处理步骤吗?
我很容易为斯维特、雷特和下杰斯做这个 但与角形有不少麻烦
我曾经尝试过的事情:
- Schematics which is not appropriate because it modifies the source code and is more for building
- ngx-ast-transform I got close with this but the AST returned is Typescript, not Angular hence I could not access the templates
- Webpack loaders which I m still experimenting with. It does not explicly give the AST that Angular works with but I m trying to use Angular compiler API to modify the loaded source code