Skip to content

Conversation

@oliverlynch
Copy link
Contributor

Changes

Create the asset output folder before writing from cache.

If the first optimised image asset is cached astro re-optimises it as the cached file could not be written to the output directory, which is created after the cache step. Instead create the output directory first to prevent the unnecessary redownload and reprocessing of the first image asset.

Testing

Tested with the astro base template with a single remote image with 3 densities added, and successfully ran pnpm --filter astro run test.
Improved test site optimised image generation time on rebuilds from ~280ms to ~1ms, although this is an extreme case.

Docs

N/A: Minor fix in caching behaviour that should conform to existing user expectations

@changeset-bot
Copy link

changeset-bot bot commented Nov 12, 2024

🦋 Changeset detected

Latest commit: fc486fa

The changes in this PR will be included in the next version bump.

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@github-actions github-actions bot added the pkg: astro Related to the core `astro` package (scope) label Nov 12, 2024
Copy link
Member

@Princesseuh Princesseuh left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks great to me! Thank you very much for contributing this fix!

@Princesseuh Princesseuh merged commit 25baa4e into withastro:main Nov 15, 2024
This was referenced Nov 15, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

pkg: astro Related to the core `astro` package (scope)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants