-
-
Notifications
You must be signed in to change notification settings - Fork 56
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
Add Eleventy transform plugin to automatically optimize image output #208
Labels
enhancement
New feature or request
Milestone
Comments
This feature will require You can get finer grained control over the images by adding HTML attributes:
Opt-in to this plugin via: import { eleventyImageTransformPlugin } from "@11ty/eleventy-img";
export default function(eleventyConfig) {
eleventyConfig.addPlugin(eleventyImageTransformPlugin, {
// which file extensions to process
extensions: "html",
// optional, output image formats
formats: ["avif", "webp", "auto"],
// optional, output image widths
// widths: ["auto"],
// optional, attributes assigned on <img> override these values.
defaultAttributes: {
loading: "lazy",
decoding: "async"
}
});
}; |
This was referenced Feb 10, 2024
This was referenced Feb 12, 2024
Docs deploying to https://www.11ty.dev/docs/plugins/image/#eleventy-transform |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
This would alleviate any need for asynchronous/synchronous shortcodes and wouldn’t require any need for markdown plugins et al.
Reuse the transform methods for the HTML
<base>
plugin and the InputPath to URL plugins.https://www.11ty.dev/docs/plugins/inputpath-to-url/
https://www.11ty.dev/docs/plugins/html-base/
Related to 11ty/eleventy#3194
The text was updated successfully, but these errors were encountered: