Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

using @variable to @import another LESS file

I'd like to use my @variable (@variable: "file.less") to import file.less to main .less.

I tried this way:

@var: 'file.less';
@import @var

or this way:

@import "@var"

or:

@import "@{var}"

but it doesn't work.

Any ideas?

like image 508
Dzik Władca Lasu Avatar asked Oct 17 '12 08:10

Dzik Władca Lasu


People also ask

How do you import LESS variables?

The best way to do this is to @import your LESS file with all your variables in it. Here's the syntax for the @import keyword: // For LESS file includes, @import "lib. less"; // or @import "lib"; // infers the .

How do you represent a variable in LESS?

Defining a variable: Variables in Less are represented with an at (@) sign. We can assign a value using a colon (:).


1 Answers

@imports are handled before @variables, so it won't work.

like image 55
Pedro Correia Avatar answered Sep 19 '22 16:09

Pedro Correia