Skip to content

Commit

Permalink
Allow symlink as input (Closes pugjs#80)
Browse files Browse the repository at this point in the history
Previous implementation used 'lstatSync'  which returns stat info about link
itself, not the file that it refers to. That behaviour didn't allow to use the
tool in case of separate build (source and build dirs are separate, and sources
linked back into  build directory).

As workaround there we could provide file content through stdin, but that
approach has limitations:
- you cannot process multiple files at once
- you cannot use 'include' directives

This commit changes the use of  'lstatSync' to 'statSync' which makes symlink
files be processed as expected.
  • Loading branch information
lazdmx authored and svallory committed Apr 23, 2023
1 parent ebc24ea commit 931f446
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion index.js
Original file line number Diff line number Diff line change
Expand Up @@ -314,7 +314,7 @@ function renderFile(path, rootPath) {
var isPug = /\.(?:pug|jade)$/;
var isIgnored = /([\/\\]_)|(^_)/;

var stat = fs.lstatSync(path);
var stat = fs.statSync(path);
// Found pug file
if (stat.isFile() && isPug.test(path) && !isIgnored.test(path)) {
// Try to watch the file if needed. watchFile takes care of duplicates.
Expand Down

0 comments on commit 931f446

Please sign in to comment.