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

Support for @layer? #340

Open
malectro opened this issue Mar 14, 2024 · 2 comments
Open

Support for @layer? #340

malectro opened this issue Mar 14, 2024 · 2 comments

Comments

@malectro
Copy link

https://developer.mozilla.org/en-US/docs/Web/CSS/@layer

Very excited to try this library! I realize this is a pretty new CSS feature, but it looks like css-inline ignores layers. Is this something you think would be easy to add? I'd be happy to try to help.

My company is hoping to add them to our CSS as a way to avoid new stuff clashing with extremely specific legacy selectors, but everything we write has to be able to safely inline for email.

example:

<style>
@layer legacy {
  div > span {
    font-weight: bold;
    color: red;
  }
}
span {
  color: blue;
}
</style>
<div><span/></div>

result:

<html><head>
</head><body><div><span style="color: blue;"></span></div>
</body></html>

expected

<html><head>
</head><body><div><span style="font-weight: bold; color: blue;"></span></div>
</body></html>
@Stranger6667
Copy link
Owner

Hi @malectro!

This library uses selectors & cssparser from Mozilla's Servo, so I think syntactically it is supported. However, it explicitly ignores all at-rules.

I am open to adding support for this, but I'd like to dive deeper into the spec for this matter. Also, if you'd like to work on it yourself, I'd be happy to assist you with reviewing PRs or giving more details about implementation.

@malectro
Copy link
Author

Hi @Stranger6667 thanks for the quick response!

Good to know about the Mozilla Servo stuff. It seems like it might not be that hard to support in that case. (Hopefully the spec isn't more complicated than it seems.) I'll take a crack at it when I have the time.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants