Transform method option to put generated image disk cache in .cache folder
Nobody has claimed this yet.
- Dominant language
- JavaScript
- Stars
- 467
- Forks
- 65
- PR merge metrics
- No merged PRs in 30d
Description
This works today to store output images into .cache/ and then copy those assets to the output folder post-build:
import fs from "node:fs";
import { eleventyImageTransformPlugin } from "@11ty/eleventy-img";
export default async function(eleventyConfig) {
// Image optimization: https://www.11ty.dev/docs/plugins/image/#eleventy-transform
eleventyConfig.addPlugin(eleventyImageTransformPlugin, {
outputDir: ".cache/@11ty/img/",
urlPath: "/img/built/",
});
eleventyConfig.on("eleventy.after", () => {
fs.cpSync(".cache/@11ty/img/", "_site/img/built/", { recursive: true });
});
}
Marginally related to https://github.com/11ty/eleventy/pull/3573
This is useful as some build servers persist .cache folder for you for free: https://www.11ty.dev/docs/deployment/#persisting-cache
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with eleventyImageTransformPlugin and its handling of outputDir and urlPath; compare the current .cache-plus-copy workaround with the requested option. Review the issue discussion and related Eleventy pull request #3573 before defining acceptance criteria, then verify generated images are cached in .cache and available in the output folder without the post-build copy.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- javascript, node.js
- Domain
- build-system
- Issue type
- Feature
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100