futursolo / stylist-rs

A CSS-in-Rust styling solution for WebAssembly Applications
https://crates.io/crates/stylist
MIT License
371 stars 22 forks source link

Syntax Error: Missing digits after the exponent symbol #157

Open Ddystopia opened 4 months ago

Ddystopia commented 4 months ago

Code like that:

css!(
  font-size: 2em;
)

Cannot be parsed by Rust - Syntax Error: Missing digits after the exponent symbol. What one must do is wrap numbers in ${}:

css!(
  font-size: ${2}em;
)

Or use raw strings. But this is pretty bad user experience.

Can something be done about it? Maybe add exception for em so that code like that:

css!(
  font-size: 2 em;
)

Would result in font-size: 2em instead of font-size: 2 em?