Skip to content

Commit f58fdba

Browse files
fix: correct file path handling for PDF generation (#756)
Co-authored-by: Sagar Seth <lightningsagar0@gmail.com> Co-authored-by: Lukasz Gornicki <lpgornicki@gmail.com>
1 parent cce723a commit f58fdba

File tree

2 files changed

+4
-3
lines changed

2 files changed

+4
-3
lines changed

hooks/99_generatePdf.js

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,9 +16,10 @@ module.exports = {
1616
try {
1717
const browser = await puppeteer.launch({args: ['--no-sandbox', '--disable-setuid-sandbox']});
1818
const page = await browser.newPage();
19-
19+
const fullPath = path.resolve(targetDir, 'index.html');
20+
const fileUrl = `file:///${fullPath.replaceAll('\\', '/')}`;
2021
// Go to prepared page with documentation
21-
await page.goto(`file://${path.join(targetDir, 'index.html')}`, { waitUntil: 'networkidle0' });
22+
await page.goto(fileUrl, { waitUntil: 'networkidle0' });
2223

2324
// Hide burger-menu in pdf
2425
await page.evaluate(() => { document.querySelector('.burger-menu').style.display = 'none'; });

scripts/transpile.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ async function transpileTemplate() {
99
console.log("Output directory for transpiled files:", outputDir);
1010
await transpileFiles(templateContentDir, outputDir, { recursive: true });
1111
} catch (error) {
12-
console.log("Error during template transpilation:", err)
12+
console.log("Error during template transpilation:", error)
1313
}
1414
}
1515

0 commit comments

Comments
 (0)