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 specificity for certain rules #22

Closed
Zn4rK opened this issue Nov 15, 2023 · 1 comment · Fixed by #29
Closed

CSS specificity for certain rules #22

Zn4rK opened this issue Nov 15, 2023 · 1 comment · Fixed by #29
Labels
engine Navita CSS rendering engine enhancement New feature or request good first issue Good for newcomers

Comments

@Zn4rK
Copy link
Contributor

Zn4rK commented Nov 15, 2023

I've come across at least one case where we need to control the CSS specificity better. It's mainly if the user is specifying the declaration:

all: unset;

Rules in a specific list needs to be rendered before rest of the CSS, and possibly live in a separate layer. Right now I can only think of "all: unset" specifically, but it should be pretty easy to just sort the rules in the css printer.

@Zn4rK Zn4rK added enhancement New feature or request good first issue Good for newcomers engine Navita CSS rendering engine labels Nov 15, 2023
@Zn4rK
Copy link
Contributor Author

Zn4rK commented Nov 15, 2023

To expand on this;

If Navita is configured to use opinionatedLayers, we'll need to specify a new layer that has lower specificity than rules.

https://github.com/eagerpatch/navita/blob/9e4ac18dd5fa9c5e74bc07290103d810f5a39588/packages/engine/src/index.ts#L218C17-L218C40

@layer static,[here],rules,at

If opinionatedLayers is not specified, we need to make sure to filter out / sort out, rules that should always be printed earlier in the document.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
engine Navita CSS rendering engine enhancement New feature or request good first issue Good for newcomers
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant