From 2d6c334acdfe0518b48bb54fe21e100e1d0e0d00 Mon Sep 17 00:00:00 2001 From: "Dmitry M. Lazutkin" Date: Wed, 26 Feb 2020 14:37:32 +0300 Subject: [PATCH] allow symlink as input 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. --- index.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/index.js b/index.js index 84cbe42..13e30dc 100644 --- a/index.js +++ b/index.js @@ -245,7 +245,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.