11ty / 11ty/image

Transform method option to put generated image disk cache in .cache folder

Open
#285 11 comments 7 reactions 0 assignees View on GitHub

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

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. 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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.