Skip to content

Commit 2ead38c

Browse files
SergeShkurkoForbesLindesay
authored andcommitted
pugjs#3040 Fix preLex fire support for plugins (pugjs#3041)
1 parent 3d8dc15 commit 2ead38c

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

packages/pug/lib/index.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -96,7 +96,8 @@ function compileBody(str, options){
9696
}).map(function (plugin) {
9797
return plugin.lex;
9898
});
99-
return applyPlugins(lex(str, lexOptions), options, plugins, 'postLex');
99+
var contents = applyPlugins(str, {filename: options.filename}, plugins, 'preLex');
100+
return applyPlugins(lex(contents, lexOptions), options, plugins, 'postLex');
100101
},
101102
parse: function (tokens, options) {
102103
tokens = tokens.map(function (token) {
@@ -146,9 +147,8 @@ function compileBody(str, options){
146147
contents = load.read(filename, loadOptions);
147148
}
148149

149-
var str = applyPlugins(contents, {filename: filename}, plugins, 'preLex');
150-
debug_sources[filename] = str;
151-
return str;
150+
debug_sources[filename] = contents;
151+
return contents;
152152
}
153153
});
154154
ast = applyPlugins(ast, options, plugins, 'postLoad');

0 commit comments

Comments
 (0)