1

How can I implement the following syntax correctly?

.jacket(@classname, @attrname, @value) {
    .class-prefix-@{classname}[some-prefix-@{attrname}~="@{value}"] {
        //                                 ^Error From Here
        // Attributes
    }
}

lessc shows that there is an SyntaxError: expected ']' got '@'

1 Answer 1

3

It seems like a bug actually, this workaround should do the trick:

.jacket(@classname, @attrname, @value) {
    @attr: ~'some-prefix-@{attrname}';
    .class-prefix-@{classname}[@{attr}~="@{value}"] {
        // ...
    }
}
Sign up to request clarification or add additional context in comments.

2 Comments

I'm getting a similar problem, but the error is Expected ']' but found '{' (rather than @ in the above). I've tried this workaround, but I'm getting the same problem with the { in the writing of attr (in the string [@{attr}...).
I've tried without the {s and now it's saying Expected ']' but found 'd', so maybe the problem is with the @, and the error is just wrong. Still not getting the workaround to do it for me, though :(

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.