P.Brian.Mackey P.Brian.Mackey - 1 year ago 206
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?

Answer Source

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

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

check here

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download