Skip to content

feat(image): add outputName option for custom asset naming#377

Open
kachkaev wants to merge 2 commits intozce:mainfrom
kachkaev:feat/output-name-option
Open

feat(image): add outputName option for custom asset naming#377
kachkaev wants to merge 2 commits intozce:mainfrom
kachkaev:feat/output-name-option

Conversation

@kachkaev
Copy link

@kachkaev kachkaev commented Feb 6, 2026

👋 @zce! Big velite fan here!

I bumped into an edge case recently and fixed it with a local pnpm patch. Since it may be useful to a wider userbase, I've decided to turn it into a PR. Feel free to ignore or recycle the diff if you don't like the solution.


This PR adds a new outputName option to s.image() that allows customizing the output filename template per-schema. This is more flexible than a simple prefix as it allows full control over the output name pattern.

Features:

  • Supports all existing placeholders: [name], [hash], [hash:N], [ext]
  • Supports subdirectories (e.g., 'logos/[name]-[hash:6].[ext]')
  • Automatically creates subdirectories in the output assets folder

PS: I started with outputPathPrefix (logo- or logo/) but then realised that outputName would cover more cases.

Add a new `outputName` option to `s.image()` that allows customizing the
output filename template per-schema. This is more flexible than a simple
prefix as it allows full control over the output name pattern.

Features:
- Supports all existing placeholders: [name], [hash], [hash:N], [ext]
- Supports subdirectories (e.g., 'logos/[name]-[hash:6].[ext]')
- Automatically creates subdirectories in the output assets folder
@kachkaev kachkaev marked this pull request as ready for review February 6, 2026 23:27
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant