feat(publisher): optimize media background images#174
Open
DavidBabinec wants to merge 2 commits into
Open
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What changed
/uploads/...CSS backgrounds to optimized variant fallbacks plusimage-set(...)candidates.Why
Image and video modules already avoid loading original multi-megabyte uploads by using media variants. Background images stored in style bags still emitted raw
url('/uploads/original.png'), so a large media-library PNG could be downloaded directly when used as a background.Impact
When a CMS media asset has generated variants, published and editor-rendered CSS backgrounds now avoid the original upload and let the browser choose from optimized variant candidates. Assets without variants continue to fall back to the stored original URL, matching the existing image fallback behavior.
Verification
bun test-> 5961 pass, 0 failbun run lint-> exit 0bun run build-> exit 0bun test src/__tests__/canvas/classStyleInjector.test.ts src/__tests__/editor/readOnlyNodeTree.test.tsx src/__tests__/publisher/classStyleInjector.test.ts src/__tests__/server/mediaBatchResolution.test.ts-> 92 pass, 0 failbun run doctor -- --verbose --diff-> warning-only diagnostics in changed files; reviewed as existing/project-approved patterns or non-blocking doctor guidance, no error-tier findings