Skip to content

Using @layer and defining a reset layer #1467

Answered by askoufis
MatthijsBon asked this question in Q&A
Discussion options

You must be logged in to vote

You're correct in that your component library's layer is ordered first because it's imported first. Layers are created as a side-effect of calling the layer function, which also means you don't need to define globalLayer(layerLibrary); it's redundant.

To fix your problem, you'll need to ensure your layers are imported in the correct order. Generally, when dealing import-order-sensitive CSS, such as reset styles and/or layers, I tend to try and organize the imports in the app entrypoint, e.g. App.tsx.

For this specific example, I also think it could be worth creating a separate entrypoint in your library that just exports the layer. For example:

// component-library/layer entrypoint
import { 

Replies: 1 comment 1 reply

Comment options

You must be logged in to vote
1 reply
@MatthijsBon
Comment options

Answer selected by MatthijsBon
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants