-
Morning. Oh wait, it's 1:00. Does anyone have any advice on how to implement dynamic styles with StyleX when you also employ a Content Security Policy that enforces no inline CSS? How could we hash or nonce it, and when in the build or run would this happen? Thanks! |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 1 reply
-
Dynamic styles are well, ... dynamic. So they are generated at runtime with JS and applied as inline styles. They can't be hashed because they aren't known ahead of time. That said, in the VAST, VAST majority of cases you don't need dynamic styles at all. So, perhaps look into alternatives to avoid using dynamic styles and use more expressive static CSS instead? Some very interesting things can be achieved with CSS and Math. |
Beta Was this translation helpful? Give feedback.
Dynamic styles are well, ... dynamic. So they are generated at runtime with JS and applied as inline styles. They can't be hashed because they aren't known ahead of time.
That said, in the VAST, VAST majority of cases you don't need dynamic styles at all. So, perhaps look into alternatives to avoid using dynamic styles and use more expressive static CSS instead?
Some very interesting things can be achieved with CSS and Math.