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

fix(css): fix inline query injection for CSS inlining #11917

Merged
merged 1 commit into from
Sep 10, 2024

Conversation

sapphi-red
Copy link
Contributor

Changes

Fixed how the inline query is injected for CSS inlining.
The previous code injected the inline query at the end and injected unnecessary = after queries without values. This was incompatible with plugin-vue resulting in this workaround.

// Some CSS modules, e.g. from Vue files, may not work with the ?inline query.
// If so, we fallback to a url instead
if (modId.includes('.module.')) {
importedCssUrls.add(importedModule.url);
}

The new code injects the inline query at the beginning and doesn't inject =.

This PR also fixes the tests failing with Vite 6 (envrionment API).
https://discord.com/channels/804011606160703521/1278362001437102163/1280816490655907863

I didn't add a changeset because this doesn't change user-facing behavior.

refs #9531

Testing

Updated a test

Docs

N/A since this is a bug fix.

Copy link

changeset-bot bot commented Sep 4, 2024

⚠️ No Changeset found

Latest commit: ca276c2

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

@github-actions github-actions bot added the pkg: astro Related to the core `astro` package (scope) label Sep 4, 2024
Copy link
Member

@bluwy bluwy left a comment

Choose a reason for hiding this comment

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

Looks great! Exactly how I imagined the fix would be when checking the bug.

@bluwy bluwy merged commit 8329d17 into withastro:main Sep 10, 2024
13 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
pkg: astro Related to the core `astro` package (scope)
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants