From 572d548a2d90a522985dae7c3f9aa83cb9d5b8b5 Mon Sep 17 00:00:00 2001 From: Zach Leatherman Date: Thu, 2 Feb 2023 15:33:10 -0600 Subject: [PATCH] Bundle on any text format! --- eleventy.shortcodes.js | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/eleventy.shortcodes.js b/eleventy.shortcodes.js index a52c7a1..3308787 100644 --- a/eleventy.shortcodes.js +++ b/eleventy.shortcodes.js @@ -52,19 +52,19 @@ module.exports = function(eleventyConfig, options = {}) { }); eleventyConfig.addTransform("@11ty/eleventy-bundle", async function(content) { - if((this.page.outputPath || "").endsWith(".html")) { - let render = new OutOfOrderRender(content); - for(let key in managers) { - render.setAssetManager(key, managers[key]); - } - - render.setOutputDirectory(eleventyConfig.dir.output); - render.setBundleDirectory(options.toFileDirectory); - render.setWriteToFileSystem(writeToFileSystem); + if(!this.page.outputPath || typeof content !== "string") { + return content; + } - return render.replaceAll(this.page); + let render = new OutOfOrderRender(content); + for(let key in managers) { + render.setAssetManager(key, managers[key]); } - return content; + render.setOutputDirectory(eleventyConfig.dir.output); + render.setBundleDirectory(options.toFileDirectory); + render.setWriteToFileSystem(writeToFileSystem); + + return render.replaceAll(this.page); }); };