From 28244658ddddfd2543c6411e6787ba37a922f284 Mon Sep 17 00:00:00 2001 From: Jonathan Niles Date: Sat, 25 Apr 2020 21:26:26 +0100 Subject: [PATCH] feat: allow external source to skip rendering Allows the exterior module to skip rendering the HTML. --- index.js | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/index.js b/index.js index a6c0cf8..33eeb30 100644 --- a/index.js +++ b/index.js @@ -35,7 +35,13 @@ async function render(html, options = {}) { let browser; try { const opts = { ...options, ...DEFAULTS }; - const inlined = await inlineSource(html, { attribute: false, rootpath: '/', compress: false }); + + + let inlined = html; + if (!options.skipRendering) { + inlined = await inlineSource(html, { attribute: false, rootpath: '/', compress: false }); + } + browser = await pptr.launch(pptrOptions); const page = await browser.newPage(); await page.setContent(inlined.trim());