Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

eleventyConfig.resolvePlugin to add core-bundled Eleventy plugins without require/import #3314

Closed
zachleat opened this issue Jun 8, 2024 · 1 comment

Comments

@zachleat
Copy link
Member

zachleat commented Jun 8, 2024

With this approach, plugin code doesn’t need to import {} from "@11ty/eleventy";, which allows greater compatibility with existing CommonJS plugins and Eleventy 3.0 pre-Node 22.

export default async function(eleventyConfig) {
  let htmlBasePlugin = await eleventyConfig.resolvePlugin("@11ty/eleventy/html-base-plugin");
  eleventyConfig.addPlugin(htmlBasePlugin);
};

Supports:

  • @11ty/eleventy/html-base-plugin
  • @11ty/eleventy/i18n-plugin
  • @11ty/eleventy/render-plugin
  • @11ty/eleventy/inputpath-to-url-plugin
@zachleat zachleat added this to the Eleventy 3.0.0 milestone Jun 8, 2024
@zachleat zachleat added the needs-documentation Documentation for this issue/feature is pending! label Jun 27, 2024
@zachleat
Copy link
Member Author

In 3.0.0-alpha.14+ some of these plugins are now sync-friendly (so they don’t require async configuration callbacks). See 11ty/eleventy-plugin-rss#52

export default async function(eleventyConfig) {
  let htmlBasePlugin = eleventyConfig.resolvePlugin("@11ty/eleventy/html-base-plugin");
  eleventyConfig.addPlugin(htmlBasePlugin);
};

Supports:

  • @11ty/eleventy/html-base-plugin (sync)
  • @11ty/eleventy/i18n-plugin (async)
  • @11ty/eleventy/render-plugin (sync)
  • @11ty/eleventy/inputpath-to-url-plugin (sync)

@zachleat zachleat removed the needs-documentation Documentation for this issue/feature is pending! label Sep 27, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant