futursolo / stylist-rs

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

Loading from css file #97

Closed amiyatulu closed 1 year ago

amiyatulu commented 1 year ago

Loading from css file gives error in version stylist = { version = "0.11.0", features=["yew"]}

let stylesheet = Style::new(STYLE_FILE).unwrap(); | ^^^^^^^^^^ the trait From<&str> is not implemented for StyleSource

Its gives no error on version="0.10.0"

const STYLE_FILE: &str = include_str!("fileupload.css");
#[styled_component(FileUpload)]
pub fn file_upload() -> Html {
    let stylesheet = Style::new(STYLE_FILE).unwrap();
WorldSEnder commented 1 year ago

As mentioned in the release notes, the parser feature is now disabled by default. You should be able to use

stylist = { version = "0.11.0", features = ["yew", "parser"] }

to dynamically load css from strings.