Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Using auto keyword with min function fails to compile #87

Open
dxrcy opened this issue Oct 30, 2023 · 1 comment
Open

Using auto keyword with min function fails to compile #87

dxrcy opened this issue Oct 30, 2023 · 1 comment

Comments

@dxrcy
Copy link

dxrcy commented Oct 30, 2023

The below SCSS code should compile, verbatim, to CSS, but fails to compile with "auto is not a number".

div {
    width: min(200px, auto);
}

Expected: no change to file, because it is already valid and correct CSS.

Minimal example:

fn main() {
    let scss = r#" div { width: min(100px, auto); } "#;
    let css = grass::from_string(scss, &grass::Options::default());
    println!("{:#?}", css);
    assert!(css.is_ok(), "Failed to compile");
}

Same result is found using 100% or 100vw instead of 100px, or switching argument order.

I would assume that min is a SCSS function (as well as CSS), expecting literal or variable arguments, not auto keyword. The error can be bypassed by not including brackets in the function call, eg. width: min 100px, auto;.

I assume this is unintended behaviour, as I could not find an explaination online or in the documentation.

@dxrcy dxrcy changed the title Can't use auto keyword with min function fails to compile Using auto keyword with min function fails to compile Oct 30, 2023
@connorskees
Copy link
Owner

This does look like a bug. Let me take a look at what's going on here and release a fix.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants