kallada
kallada

Reputation: 1929

LESS compilation error

I'm trying the following statement in LESS, but its giving me an error:

(~".table-column[width='@{size}']") {
    // do something
}
----------
ERROR :
---------- 
*ParseError: Missing closing ')'*

I'm using lessc 2.5.3, with nodejs on windows. LESS is new to me and any pointers would be helpful.

Thanks

Upvotes: 2

Views: 89

Answers (1)

scniro
scniro

Reputation: 16989

No need for the parens, nor the string quotes, nor the ~ (unless you are trying to use a ~ sibling selector). Observe the following...

@size: 40px;

.table-column[width='@{size}'] {
    background-color: tomato;
}

// -- conversion
.table-column[width='40px'] {
    background-color: tomato;
}

Codepen link - working demo

Also check out the LESS variables docs - specifically, variable interpolation, for more information.

Upvotes: 3

Related Questions