P.Brian.Mackey
P.Brian.Mackey

Reputation: 44275

Using JavaScript in Less

@root: "/images";
@app-root: `"@{root}".toUpperCase()`;

#form {
    background: url("@{app-root}/back.jpg");
}

Running this in LESS2CSS I get error:

SyntaxError: JavaScript evaluation error: Unexpected string from ""/images"".toUpperCase() on line 2, column 12:

1 @root: "/images"; 2 @app-root: "@{root}".toUpperCase(); 3

Supposedly all I need to run JS in LESS is a set of backticks. So, why does this fail?

Upvotes: 2

Views: 40

Answers (1)

Poul Kruijt
Poul Kruijt

Reputation: 71901

Remove the double quotes, and you are good to go:

@app-root: `@{root}.toUpperCase()`;

check here

Upvotes: 3

Related Questions