diff --git a/package.json b/package.json index db454c7..53f94ce 100644 --- a/package.json +++ b/package.json @@ -118,6 +118,7 @@ "@typescript-eslint/prefer-readonly-parameter-types": "off", "camelcase": "off", "capitalized-comments": "off", + "no-await-in-loop": "off", "no-promise-executor-return": "off", "node/no-unsupported-features/es-syntax": "off", "unicorn/no-array-callback-reference": "off", diff --git a/src/lib/generate-output.ts b/src/lib/generate-output.ts index 010979c..0144c6b 100644 --- a/src/lib/generate-output.ts +++ b/src/lib/generate-output.ts @@ -30,14 +30,17 @@ export async function generateOutput(html: string, relativePath: string, config: await page.goto(`http://localhost:${config.port!}${relativePath}`); // make sure relative paths work as expected await page.setContent(html); // overwrite the page content with what was generated from the markdown - await Promise.all([ - ...config.stylesheet.map( - async (stylesheet) => page.addStyleTag(isHttpUrl(stylesheet) ? { url: stylesheet } : { path: stylesheet }), // add each stylesheet - ), - config.css ? page.addStyleTag({ content: config.css }) : undefined, // add custom css - ]); + for (const stylesheet of config.stylesheet) { + await page.addStyleTag(isHttpUrl(stylesheet) ? { url: stylesheet } : { path: stylesheet }); + } - await Promise.all(config.script.map(async (scriptTagOptions) => page.addScriptTag(scriptTagOptions))); + if (config.css) { + await page.addStyleTag({ content: config.css }); + } + + for (const scriptTagOptions of config.script) { + await page.addScriptTag(scriptTagOptions); + } /** * Trick to wait for network to be idle.