Skip to content

Comments

feat(enhanced-img): add configurable image defaults and imagetools options#15354

Open
blt-r wants to merge 6 commits intosveltejs:mainfrom
blt-r:enhanced_img_config
Open

feat(enhanced-img): add configurable image defaults and imagetools options#15354
blt-r wants to merge 6 commits intosveltejs:mainfrom
blt-r:enhanced_img_config

Conversation

@blt-r
Copy link
Contributor

@blt-r blt-r commented Feb 19, 2026

closes #12615, #13085, and maybe #14834 (the imagetools.include option).

Ooptions

  • defaultFormats(meta) => string

    • Used only for ?enhanced images.
    • Must return a ;-separated format list for imagetools format (e.g. avif;webp;jpg).
    • Default behavior remains.
  • defaultWidths(width, sizes) => { w: string; basePixels?: string }

    • Used only for ?enhanced images.
    • Returns imagetools width directives:
      • w: ;-separated output widths
      • basePixels (optional): enables density (x) descriptors
    • Default behavior remains.
  • imagetools?: VitePluginOptions

    • Pass-through config to vite-imagetools (include, exclude, removeMetadata, etc.).
  • imagetools.defaultDirectives: If URL has ?enhanced: user-provided imagetools.defaultDirectives is ignored, otherwise it is used.


Please don't delete this checklist! Before submitting the PR, please make sure you do the following:

  • It's really useful if your PR references an issue where it is discussed ahead of time. In many cases, features are absent for a reason. For large changes, please create an RFC: https://github.com/sveltejs/rfcs
  • This message body should clearly illustrate what problems it solves.
  • Ideally, include a test that fails without this PR but passes with it.

Tests

  • Run the tests with pnpm test and lint the project with pnpm lint and pnpm check

Changesets

  • If your PR makes a change that should be noted in one or more packages' changelogs, generate a changeset by running pnpm changeset and following the prompts. Changesets that add features should be minor and those that fix bugs should be patch. Please prefix changeset messages with feat:, fix:, or chore:.

Edits

  • Please ensure that 'Allow edits from maintainers' is checked. PRs without this option may be closed.

@changeset-bot
Copy link

changeset-bot bot commented Feb 19, 2026

🦋 Changeset detected

Latest commit: 3a02de3

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

This PR includes changesets to release 1 package
Name Type
@sveltejs/enhanced-img Minor

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

@svelte-docs-bot
Copy link

blt-r and others added 2 commits February 22, 2026 01:54
Co-authored-by: vercel[bot] <35613825+vercel[bot]@users.noreply.github.com>
Co-authored-by: vercel[bot] <35613825+vercel[bot]@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add ability to configure cache directory for image conversions in @sveltejs/enhanced-img

2 participants