Skip to content

Commit

Permalink
Adds enabled option to HtmlTransformer plugins for 11ty/eleventy-pl…
Browse files Browse the repository at this point in the history
  • Loading branch information
zachleat committed Sep 10, 2024
1 parent d64b007 commit ddff045
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion src/Util/HtmlTransformer.js
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,13 @@ class HtmlTransformer {
}

getPlugins(extension) {
return this.plugins[extension] || [];
let plugins = this.plugins[extension] || [];
return plugins.filter(({ enabled }) => {
if (!enabled || typeof enabled !== "function") {
return true;
}
return enabled();
});
}

static async transformStandalone(content, callback, posthtmlProcessOptions = {}) {
Expand Down

0 comments on commit ddff045

Please sign in to comment.