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

Improve CSS imports #639

Merged
merged 1 commit into from
Mar 25, 2024
Merged

Improve CSS imports #639

merged 1 commit into from
Mar 25, 2024

Conversation

paulomarg
Copy link
Contributor

WHY are these changes introduced?

In some cases, importing global frontend CSS files as modules can cause the CSS to be wiped out when a file is saved and triggers an HMR reload in the template.

WHAT is this pull request doing?

Loading global CSS files whose classes we don't need to reference in the code with a ?url flag so they're loaded from the URL, and don't break on HMR reloads.

@paulomarg paulomarg requested a review from a team as a code owner March 25, 2024 15:53
@paulomarg paulomarg merged commit ca8f76a into main Mar 25, 2024
1 check passed
@paulomarg paulomarg deleted the fix_css_imports branch March 25, 2024 17:34
paulomarg added a commit that referenced this pull request Mar 25, 2024
@muchisx
Copy link

muchisx commented Mar 28, 2024

@paulomarg just a headsup i tested this and I think it breaks vite builds
remix-run/remix#8813

there's a fix in the remix package now so maybe updating the dependency in the template to 2.7.2 should do?
remix-run/remix#8829

@paulomarg
Copy link
Contributor Author

Yeah, it looks like updating is the right fix here - new apps won't have a lock file, so they should automatically get the latest version. We'll still update the template's package.json to reflect that.

For existing apps, updating should fix that! Thanks for digging into it.

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.

3 participants