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

Vite moves @import at the top leading to an erroneous layers order #18384

Open
7 tasks done
ellhn opened this issue Oct 17, 2024 · 2 comments
Open
7 tasks done

Vite moves @import at the top leading to an erroneous layers order #18384

ellhn opened this issue Oct 17, 2024 · 2 comments
Labels
bug: upstream Bug in a dependency of Vite feat: css p3-minor-bug An edge case that only affects very specific usage (priority)

Comments

@ellhn
Copy link

ellhn commented Oct 17, 2024

Describe the bug

I am applying the following css:

@layer reset, bootstrap;
@import url('https://cdn.jsdelivr.net/npm/[email protected]/dist/css/bootstrap.css') layer(bootstrap);

@layer reset {
  h1 {
    margin-top: 100px;
  }
}

to <h1>Text</h1>

I am expecting:
bootstrap layer to take precedence over reset layer and h1 to have a top margin of 0px.

What is actually happening:
reset layer takes precedence over bootstrap layer and h1 has a top margin of 100px.

Reproduction

https://stackblitz.com/edit/vitejs-vite-ucaxjr?file=main.js,style.css&terminal=dev

Steps to reproduce

No response

System Info

Chrome and Firefox

Used Package Manager

npm

Logs

No response

Validations

Copy link

stackblitz bot commented Oct 17, 2024

Fix this issue in StackBlitz Codeflow Start a new pull request in StackBlitz Codeflow.

@sapphi-red
Copy link
Member

This seems to be an upstream issue: postcss/postcss-import#567

@sapphi-red sapphi-red added bug: upstream Bug in a dependency of Vite feat: css p3-minor-bug An edge case that only affects very specific usage (priority) labels Oct 18, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug: upstream Bug in a dependency of Vite feat: css p3-minor-bug An edge case that only affects very specific usage (priority)
Projects
None yet
Development

No branches or pull requests

2 participants