Skip to content

Commit

Permalink
Bundle on any text format!
Browse files Browse the repository at this point in the history
  • Loading branch information
zachleat committed Feb 2, 2023
1 parent 2d0b9f5 commit 572d548
Showing 1 changed file with 11 additions and 11 deletions.
22 changes: 11 additions & 11 deletions eleventy.shortcodes.js
Original file line number Diff line number Diff line change
Expand Up @@ -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);
});
};

0 comments on commit 572d548

Please sign in to comment.