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
SCSS @use vs CSS @layer Problems.... plz fixed.. this issues.. #3842
Comments
We generally recommend wrapping partials in mixins, so that instead of having your @use 'components';
@use 'pages';
@layer reset, components, utility;
@include components.styles;
@include pages.styles; That said, we should probably move the |
These rules are only allowed at the beginning of stylesheets. Allowing them anywhere in Sass and moving them to the top of the output matches the behavior of plain-CSS `@import` rules. Closes #3842
Looking into this deeper: a Also, a better alternative for handling this might be to put your // _layers.scss
@layer reset, components, utility; // styles.scss
@use 'layers';
@use 'components';
@use 'pages'; Or better yet, |
So we've got an interesting design question here. Currently, the following Sass file: @layer foo;
@import 'bar.css'; produces: @import 'bar.css';
@layer foo; This is a clear violation of CSS compatibility, since the input is valid CSS as-is and the output has different semantics. On the other hand: a {b: c}
@layer foo; produces the correct output, behavior that should be retained. That raises the question of how to handle a case like the following: a {b: c}
@layer foo;
@import 'bar.css'; Should this |
// _layers.scss
@layer reset, components, utility; // styles.scss
@use 'layers';
@use 'components';
@use 'pages'; I used this method and solved it. |
Re-opening because we still need to fix the issues described in #3842 (comment) |
While using CSS's @layer in scss,
I found that it did not work in files that had to be compiled at the top level.
The contents of my compiled file are as follows.
//style.scss
@layer reset, components, utility;
@use 'components';
@use 'pages';
The problem in that code is
@use must be at the top of the code
This problem seems to have arisen because it is similar to the @layer concept in CSS.
Is there a way to fix this problem or can it be fixed in a future update?
I wrote this issue through a translator.
Some expressions may be strange.
The text was updated successfully, but these errors were encountered: