From edfdea0061ca978562df8d467897668648cb764e Mon Sep 17 00:00:00 2001 From: Matheus Afonso Martins Moreira Date: Sun, 3 Sep 2023 01:04:46 -0300 Subject: [PATCH] pugneum: pass base directory to pugneum modules What's the point of reading the configuration variable if it's not used? Pass it to the pugneum modules so they can resolve absolute paths. --- packages/pugneum/cli.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/packages/pugneum/cli.js b/packages/pugneum/cli.js index ad8bf4d8..4801ef5f 100755 --- a/packages/pugneum/cli.js +++ b/packages/pugneum/cli.js @@ -57,6 +57,7 @@ const {baseDirectory, inputDirectory, outputDirectory} = readAndValidateInput(pr const pg = require('pugneum'); const pgExtension = /\.pg$/; +const pgOptions = { basedir: baseDirectory }; function isPugneum(file) { return pgExtension.test(file); @@ -82,7 +83,7 @@ function compilePugneumAndSave(input) { const relative = path.relative(inputDirectory, input); const outputPath = path.join(outputDirectory, relative).replace(pgExtension, '.html'); const directory = path.dirname(outputPath); - const output = pg.renderFile(input); + const output = pg.renderFile(input, pgOptions); fs.mkdirSync(directory, { recursive: true }); fs.writeFileSync(outputPath, output, { encoding: 'utf8' }); }