Skip to content

Commit f129a19

Browse files
committed
Provide an option called plugins to process ast in vue-template-compiler (close #5703)
1 parent 07a3726 commit f129a19

File tree

2 files changed

+5
-0
lines changed

2 files changed

+5
-0
lines changed

Diff for: flow/compiler.js

+2
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,8 @@ declare type CompilerOptions = {
2121

2222
// runtime user-configurable
2323
delimiters?: [string, string]; // template delimiters
24+
25+
plugins?: Array<Function>; // customizing plugins to process ast
2426
};
2527

2628
declare type CompiledResult = {

Diff for: src/compiler/index.js

+3
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,9 @@ export const createCompiler = createCompilerCreator(function baseCompile (
1414
): CompiledResult {
1515
const ast = parse(template.trim(), options)
1616
optimize(ast, options)
17+
if (options.plugins) {
18+
options.plugins.forEach(plugin => plugin(ast, options))
19+
}
1720
const code = generate(ast, options)
1821
return {
1922
ast,

0 commit comments

Comments
 (0)