P.Brian.Mackey P.Brian.Mackey - 2 months ago 7x
Less Question

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
on line 2, column 12:

1 @root: "/images"; 2 @app-root:
; 3

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


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

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

check here