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

@namespace at-rule gets omitted #343

Closed
neet opened this issue Feb 4, 2025 · 0 comments · Fixed by #344
Closed

@namespace at-rule gets omitted #343

neet opened this issue Feb 4, 2025 · 0 comments · Fixed by #344

Comments

@neet
Copy link

neet commented Feb 4, 2025

Hi, thank you for maintaining an awesome project.

While I'm trying to use CSS @namespace feature, I'm having trouble with the at-rule always gets omitted.

Consider the following input, which I borrowed from an MDN article.

import { compile, serialize, stringify } from 'stylis'

const css = `
@namespace svg url('http://www.w3.org/2000/svg');

a {
  color: orangered;
  text-decoration: underline dashed;
  font-weight: bold;
}

svg|a {
  fill: blueviolet;
  text-decoration: underline solid;
  text-transform: uppercase;
}
`

console.log(serialize(compile(css), stringify))

We get the following CSS as an output. Note that it lacks the @namespace rule.

a{color:orangered;text-decoration:underline dashed;font-weight:bold;}svg|a{fill:blueviolet;text-decoration:underline solid;text-transform:uppercase;}

You can see the full reproducible code from the repository below.
https://github.com/neetlab/stylis-namespace-omitted

@neet neet changed the title @namespace at-rule get omitted @namespace at-rule gets omitted Feb 4, 2025
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

Successfully merging a pull request may close this issue.

1 participant