inline-css 0.0.3

Embed CSS directly in your Rust code
Documentation

inline-css

Inline CSS directly into your Rust code.

Example

use inline_css::css;

fn main() {
    let css = css! {
        h1 {
            color: red;
        }
    };
    
    println!("{css}");
}

Syntax issues

margin: 10em;

This doesn't work because Rust expects an exponent after the e. The workaround is to write 10m, which the macro implicitly converts to 10em.

padding: calc(10 - 1);

Unsupported, use padding: {10 - 1}; instead.

color: #0000ef;

Impossible to parse, use color: #0xff00ff; instead.

color: #0x0ff;

Is interpreted as color: #0x0000ff;, please use color: #0x00ffff; instead.

TODO

  • Documentation
  • Parse h1::after {}