From 3d14f18d32b635dcfe74448ea1bad9bd68a1684e Mon Sep 17 00:00:00 2001 From: Lea Rosema Date: Wed, 25 Sep 2024 01:32:15 +0200 Subject: [PATCH] chore: wip --- src/transforms/bundle.js | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/transforms/bundle.js b/src/transforms/bundle.js index 0dd7d51..989dd21 100644 --- a/src/transforms/bundle.js +++ b/src/transforms/bundle.js @@ -11,7 +11,7 @@ const SYNTAXES = { * @param {'html'|'css'} syntax * @returns {Promise} return the bundled resource */ -async function bundle(inputContent, resolve, syntax) { +async function bundle(inputContent, resolve, syntax, processor) { const includes = new Map(); let content = inputContent, matches; const includePattern = SYNTAXES[syntax]; @@ -22,7 +22,8 @@ async function bundle(inputContent, resolve, syntax) { const fullPath = path.join(config.dir.input, config.dir.includes, file); try { const content = await resolve(fullPath); - includes.set(file, content); + + includes.set(file, await (await processor(content, file)).compile(data)); } catch (err) { console.error('error processing file:', fullPath, err); // silently fail if there is no include @@ -30,7 +31,7 @@ async function bundle(inputContent, resolve, syntax) { } } content = content.replace(includePattern, (_, file) => { - return includes.get(file) + return includes.get(file); }); } }