Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Rewrite urls in CSS files when using Vite #14877

Merged
merged 10 commits into from
Nov 7, 2024
Merged

Conversation

thecrypticace
Copy link
Contributor

@thecrypticace thecrypticace commented Nov 5, 2024

Fixes #14784

This is an alternative to #14850 in which we actually perform url rewriting / rebasing ourselves. We ported a large portion of the URL-rewriting code from Vite (with attribution) to use here with some minor modifications. We've added test cases for the url rewriting so verifying individual cases is easy. We also wrote integration tests for Vite that use PostCSS and Lightning CSS that verify that files are found and inlined or relocated/renamed as necessary.

We also did some manual testing in the Playground to verify that this works as expected across several CSS files and directories which you can see a screenshot from here:

Screenshot 2024-11-05 at 10 25 16

@thecrypticace thecrypticace requested a review from a team as a code owner November 5, 2024 15:33
thecrypticace and others added 4 commits November 5, 2024 17:55
Add stub test for lightningcss

This fails so its marked as a `todo` test.
Co-authored-by: Philipp Spiess <hello@philippspiess.com>
Copy link
Member

@philipp-spiess philipp-spiess left a comment

Choose a reason for hiding this comment

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

Left some small notes but LGTM. I did co-author it with you tho so someone else should look over it 😄

thecrypticace and others added 3 commits November 6, 2024 12:26
Co-authored-by: Philipp Spiess <hello@philippspiess.com>
Co-authored-by: Philipp Spiess <hello@philippspiess.com>
@adamwathan adamwathan merged commit e82b316 into next Nov 7, 2024
1 check passed
@adamwathan adamwathan deleted the fix/v4-url-rewriting branch November 7, 2024 14:52
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.

[4 alpha] breaks the default Vite url(...) references in imported CSS files.
4 participants