In CSS, @import "typography" layer(typography)
will scope an import to that cascade layer.
However, in Sass @import
is deprecated, and according to this Sass issue, it doesn't seem like the plan is to support layer()
function for @use
.
Is there an equivalent way to attach imported @use
styles to a cascade layer?
Neither of these solutions currently work:
@use 'typography' layer(typography)
@layer typography {
@use 'typography';
}
The only way seems to be modifying the file being imported to wrap everything in a layer, which is an option in some cases but not if it's an external library.