Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How do I import .less files with string interpolation in the pathstring?

How do I import .less files with string interpolation in the pathstring.

@folder: "LessFiles";

I tried this

@import "@{folder}/file.less";

Error:
File Not Found. 
HTTP GET Url is "%7Bfolder%7D/file.less" 

and this:

@import formatString("{0}/file.less",@folder);

Error:
Server throws System.NullReferenceException

and this:

@path: "@{folder}/file.less";

@import @path;

Error:
directive block with unrecognised format on line 16 in file 'test.less':
 [15]: 
 [16]: @import @path;
       --------^
 [17]: 

Any tips how to solve this?

Thanks!

like image 900
smunar Avatar asked Sep 11 '12 12:09

smunar


1 Answers

As of Less 1.4.0 variable interpolation is possible with @imports

Example

@bacon: "../bacon";

@import @{bacon}/smokey.less; 

More information can be found here - Less Language Features import statements

like image 79
Colin Bacon Avatar answered Oct 16 '22 03:10

Colin Bacon