futursolo / stylist-rs

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

Add source locations, powered by #[track_caller] #63

Closed WorldSEnder closed 2 years ago

WorldSEnder commented 2 years ago

Adds a (non-functional) additional class to the element when compiled with debug_assertions, i.e. in development mode.

Uses the #[track_caller] API to determined where a style was created and then "formats" that as a css class name. Addresses the underlying issue of #61 , adding debug possiblities to determine where a style is coming from.

WorldSEnder commented 2 years ago

@Madoshakalaka tell me what you think, maybe you have the time to try out this branch and check how useful it is in practice.

Madoshakalaka commented 2 years ago

Looks good! This definitely works! I also agree with @futursolo that something like <div class="stylist-abcdefgh" data-yew-element-def="myapp::components::header::Header"></div> should be done in Yew

futursolo commented 2 years ago

In addition, can we have a way to disable this and do you think it should be on by default?