Categories
post

LESS CSS Strings

I saw a tweet about LESS CSS today that I was able to answer with some simple trials. The question came from @funkatron: “Can any LESS.js nerds tell me how I could use a variable to set a base path for various `url()`s? like `background: url(@BASEPATH/foo.png)`”

The solution was quite simple after some trial and error.

@BASEPATH: ‘/PATH/TO/BASE’;
#element {
url({@BASEPATH}/foo.png);
}

Turns out it doesn’t work in lessc. I use PHP Less CSS. (plessc)