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

CSS Modules inject order #8558

Closed
1 task
ymatuhin opened this issue Sep 14, 2023 · 6 comments · Fixed by #8877
Closed
1 task

CSS Modules inject order #8558

ymatuhin opened this issue Sep 14, 2023 · 6 comments · Fixed by #8877
Assignees
Labels
- P4: important Violate documented behavior or significantly impacts performance (priority) feat: dev Related to `astro dev` CLI command (scope) feat: styling Related to styles (scope)

Comments

@ymatuhin
Copy link

ymatuhin commented Sep 14, 2023

Astro Info

Astro                    v3.0.13
Node                     v18.17.1
System                   macOS (arm64)
Package Manager          pnpm
Output                   static
Adapter                  none
Integrations             @astrojs/preact

If this issue only occurs in one browser, which browser is a problem?

Chrome

Describe the Bug

When I import CSS modules from Preact component, is goes first in order of all styles. Even before global styles. That messes up specificity for components.

What's the expected result?

They should be treated as scoped css and be applied after globals.

Link to Minimal Reproducible Example

https://stackblitz.com/edit/github-k1nega-mj5wcr?file=src%2Fcomponents%2FCounter.module.css

Participation

  • I am willing to submit a pull request for this issue.
Screenshot 2023-09-14 at 17 05 02
@github-actions github-actions bot added the needs triage Issue needs to be triaged label Sep 14, 2023
@natemoo-re
Copy link
Member

Just to confirm, does the issue only occur in dev mode? Is the astro build output different?

@ymatuhin
Copy link
Author

Just to confirm, does the issue only occur in dev mode? Is the astro build output different?

Nope, build output has the same issue.

@lilnasy
Copy link
Contributor

lilnasy commented Sep 14, 2023

Could not reproduce the issue (edit: ...in build, the issue exists in dev). The text renders green as expected.

image

I find it really odd that in your screenshot global.css is a script. This is the result I'm getting from building your project.
image

You might want to open a support thread on our discord to confirm the production issue: https://astro.build/chat.

@lilnasy lilnasy closed this as not planned Won't fix, can't repro, duplicate, stale Sep 14, 2023
@duncannah
Copy link

duncannah commented Sep 17, 2023

I'm having this same problem, only occurs on production build

EDIT: Seems like the issue I was having was unrelated, being caused by a third-party plugin.

@lilnasy lilnasy reopened this Sep 17, 2023
@lilnasy
Copy link
Contributor

lilnasy commented Sep 17, 2023

@duncannah I can reproduce this issue only in dev mode. Could you open another issue with a minimal reproduction?

@lilnasy lilnasy added feat: styling Related to styles (scope) - P4: important Violate documented behavior or significantly impacts performance (priority) feat: dev Related to `astro dev` CLI command (scope) and removed needs triage Issue needs to be triaged labels Sep 17, 2023
@ymatuhin
Copy link
Author

@lilnasy yeah, looks like it happens only in dev mode. Sorry for misguidance.

@bluwy bluwy self-assigned this Oct 9, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
- P4: important Violate documented behavior or significantly impacts performance (priority) feat: dev Related to `astro dev` CLI command (scope) feat: styling Related to styles (scope)
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants