Skip to content

Resolve/load url() references in CSS #14686

@benmccann

Description

@benmccann

Description

vite-imagetools transforms images to more efficient file formats. This works great for images included via an import in the JS. However, Vite's url() references are only being half handled today. Vite's static asset handling does rename these assets to have a hash in their name. But the vite-imagetools plugin is never invoked, so we can't do think like change jpg/png images to webp.

Suggested solution

Invoke Vite plugins on asset URLs found in CSS just as is done for asset URLs found in JS

Alternative

No response

Additional context

This is one of the top feature requests in vite-imagetools: JonasKruckenberg/imagetools#563

Validations

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or requestfeat: cssp3-downstream-blockerBlocking the downstream ecosystem to work properly (priority)

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions