microsoft / griffel

CSS-in-JS with ahead-of-time compilation ⚡️
https://griffel.js.org
MIT License
1.18k stars 60 forks source link

core: `makeStaticStyles` to support @at-rules #537

Open jligeza opened 5 months ago

jligeza commented 5 months ago

This code:

export default makeStyles({
  ':root': {
    backgroundColor: 'red',
    '@media screen': {
      color: 'blue',
    }
  }
});

Produces this:

.f3xbvq9 {
  background-color: red;
}

@media screen {
  .f16lhzc5 {
    color: blue;
  }
}

While this code:

export default makeStaticStyles({
  ':root': {
    backgroundColor: 'red',
    '@media screen': {
      color: 'blue',
    }
  }
});

Produces this (missing media query):

:root {
  background-color: red;
}

Other functions such as @supports also don't work. It is not mentioned in documentation that media query is not supported, but even if it isn't, I think it should, as it is rather important.

layershifter commented 5 months ago

Indeed, good catch 👍 Would be nice to support it.

FelixWiecz commented 2 weeks ago

@layershifter any plans to implement that? :)

layershifter commented 1 week ago

@layershifter any plans to implement that? :)

@FelixWiecz we don't have plans on it currently :(