Skip to content

Commit

Permalink
Show compiled templates in debugger (#456)
Browse files Browse the repository at this point in the history
This commit adds a sourceURL directive to the generated template function.
This makes generated template code visible in the debugger.
See https://developer.mozilla.org/en-US/docs/Tools/Debugger/How_to/Debug_eval_sources
  • Loading branch information
S2- authored and ExE-Boss committed Sep 10, 2019
1 parent 3dc11e9 commit 09c0f51
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions lib/ejs.js
Expand Up @@ -611,6 +611,10 @@ Template.prototype = {
if (opts.debug) {
console.log(src);
}
if (opts.compileDebug && opts.filename) {
src = src + '\n'
+ '//# sourceURL=' + opts.filename + '\n';
}

try {
if (opts.async) {
Expand Down

0 comments on commit 09c0f51

Please sign in to comment.