Skip to content

Commit

Permalink
#3040 Fix preLex fire support for plugins (#3041)
Browse files Browse the repository at this point in the history
  • Loading branch information
SergeShkurko authored and ForbesLindesay committed Aug 3, 2018
1 parent 3d8dc15 commit 2ead38c
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions packages/pug/lib/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,8 @@ function compileBody(str, options){
}).map(function (plugin) {
return plugin.lex;
});
return applyPlugins(lex(str, lexOptions), options, plugins, 'postLex');
var contents = applyPlugins(str, {filename: options.filename}, plugins, 'preLex');
return applyPlugins(lex(contents, lexOptions), options, plugins, 'postLex');
},
parse: function (tokens, options) {
tokens = tokens.map(function (token) {
Expand Down Expand Up @@ -146,9 +147,8 @@ function compileBody(str, options){
contents = load.read(filename, loadOptions);
}

var str = applyPlugins(contents, {filename: filename}, plugins, 'preLex');
debug_sources[filename] = str;
return str;
debug_sources[filename] = contents;
return contents;
}
});
ast = applyPlugins(ast, options, plugins, 'postLoad');
Expand Down

0 comments on commit 2ead38c

Please sign in to comment.