libsass icon indicating copy to clipboard operation
libsass copied to clipboard

Unclear error message with :first-child and :last-child

Open rim-odoo opened this issue 3 years ago • 0 comments

Hello

I found a weird behaviour when attempting to fix https://github.com/odoo/enterprise/pull/11881

input.scss

This CSS is deliberately WRONG.

div {
    ul:first-child() {
        font-family: Arial;
    }
}

(can also be tested with :last-child())

Actual results

libsass 3.6.4 python-libsass 0.19.4

pysassc: error: Error: Custom property values may not be empty.
        on line 2:8 of test.scss
>>     ul:first-child() {

   -------^

Expected result

I know that my CSS is wrong (in older versions, it would have failed silently. It is good that the compiler now fails on broken CSS).

:arrow_right: the error message that is thrown mentions "custom property values" :arrow_right: :first-child and :last-child are not "custom properties" as far as I know

I did some research and found this: https://github.com/sass/libsass/pull/2882

Wouldn't the error message be a side-effect of that change? Shouldn't it be changed to be more explicit and return something like "Invalid CSS" ?

Thanks for your comments, I'm available if you need any other info

rim-odoo avatar Jul 16 '20 10:07 rim-odoo