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

Allow transformer to be registered at the template level #408

Closed
patrick-steele-idem opened this issue Nov 8, 2016 · 0 comments
Closed
Assignees
Labels
Milestone

Comments

@patrick-steele-idem
Copy link
Contributor

patrick-steele-idem commented Nov 8, 2016

Currently, a transformer can only be associated with a tag. Certain transforms should be executed once for the entire template.

We should add support for a new transformer property within a marko.json file:

marko.json:

{
  "transformer": "./my-transformer.js"
}

Template-level transformers should be invoked once after parsing, but before traversing the tree to run transformers on HTML elements. A template-level transformer should be invoked with only one argument that is the CompilerContext:

module.exports = function transform(rootNode, context) {
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant