Skip to content

Commit

Permalink
pugneum: pass base directory to pugneum modules
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
matheusmoreira committed Sep 3, 2023
1 parent cea7006 commit edfdea0
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion packages/pugneum/cli.js
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand All @@ -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' });
}
Expand Down

0 comments on commit edfdea0

Please sign in to comment.