abishekatp / stylers

Fully compile time scoped CSS for Leptos components
MIT License
139 stars 13 forks source link

Quotes are removed around data url #49

Closed svieujot closed 1 year ago

svieujot commented 1 year ago

The following rule gets rendered without the quotes around the url.

.wingman :deep(.btn[disabled]::after) {
    content: url("data:image/svg+xml;charset=UTF-8, <svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 512 512'><path fill='red' d='M256 8C119.034 8 8 119.033 8 256s111.034 248 248 248 248-111.034 248-248S392.967 8 256 8zm130.108 117.892c65.448 65.448 70 165.481 20.677 235.637L150.47 105.216c70.204-49.356 170.226-44.735 235.638 20.676zM125.892 386.108c-65.448-65.448-70-165.481-20.677-235.637L361.53 406.784c-70.203 49.356-170.226 44.736-235.638-20.676z'></path></svg>");
}
abishekatp commented 1 year ago

Hi @svieujot, By default we will remove the double quotes around the css property. That might be an issue here.

svieujot commented 1 year ago

Hello @abishekatp . Thank you for the feedback.

I tried several combinations of those but I can't make it work.

Please see this test:

#[test]
fn test_55() {
    let style = style_test! {
        .btn.disabled::after {
            content: url(raw_str(r#"data:image/svg+xml;charset=UTF-8, <svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 512 512'><path fill='red' d='M256 8C119.034 8 8 z'></path></svg>"#));
        }
    };
    assert_eq!(
        style,
        r#".btn.disabled.test::after{content: url("data:image/svg+xml;charset=UTF-8, <svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 512 512'><path fill='red' d='M256 8C119.034 8 8 z'></path></svg>");}"#
    );
}

Am I doing something wrong ?

abishekatp commented 1 year ago

I think the following code will solve this problem.(Thank you for you patience 😀)

#[test]
fn test_55() {
    let style = style_test! {
        .btn.disabled::after {
            content: r#"url("data:image/svg+xml;charset=UTF-8, <svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 512 512'><path fill='red' d='M256 8C119.034 8 8 z'></path></svg>")"#;
        }
    };
    assert_eq!(
        style,
        r#".btn.disabled.test::after{content: url("data:image/svg+xml;charset=UTF-8, <svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 512 512'><path fill='red' d='M256 8C119.034 8 8 z'></path></svg>");}"#
    );
}
svieujot commented 1 year ago

Indeed it does.

Thank you !