Process Tailwind output with Vite CSS plugins#13218
Merged
Conversation
Contributor
Author
|
@ArnaudBarre I'm interested in your review here. In particular, do you see any cases where this won't work with other plugins correctly? |
|
Answered in Discord: this way of doing things doesn't make the CSS hash independent of the utils content. To workaround that I found that calling again the transform function of the |
a9f1bc7 to
4e8b9c5
Compare
Contributor
Author
|
@ArnaudBarre The PR has been updated to apply the |
23351b5 to
0a4d7df
Compare
thecrypticace
suggested changes
Mar 22, 2024
Contributor
|
Some small changes but otherwise looks good and appears to work quite well. 💯 |
We were using setTimeout to wait for the initial scan to complete before generating Tailwind CSS. Now that full builds wait until the bundle stage, dev builds can simply run immediately. This might generate Tailwind CSS twice, generating a FOUC, but will be faster than waiting for the timeout. A [proposed Vite change](vitejs/vite#16135) could address the FOUC and extra build.
Co-authored-by: Jordan Pittman <jordan@cryptica.me>
Co-authored-by: Jordan Pittman <jordan@cryptica.me>
4b077e2 to
5557aeb
Compare
thecrypticace
approved these changes
Mar 22, 2024
Merged
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.
Transform Tailwind-generated CSS with Vite CSS plugins.
vite:cssdoes useful things like transformingurl()paths and inlining images.vite:css-postgenerates bundle hashes. Before this change, the CSS bundle hash wasn't changing when the generated CSS changed.