ttback
ttback

Reputation: 2111

LESS import issue

Trying out a simple one, three less files:

colors.less:

@green:green;

background.less

body {
   background-color: @green;
}

main.less

@import: "colors.less";
@import: "background.less";

When I

 lessc main.less main.css

Nothing is in output. I thought when you import less files, it will get resolved. Double-checked with how twitter bootstrap is doing it...it seems to work fine for them. I am using lessc 1.3.3 (LESS Compiler) [JavaScript] as LESS compiler

Upvotes: 1

Views: 324

Answers (2)

Luke Page
Luke Page

Reputation: 8186

the colon turns it into a variable declaration. remove the colon.

@import "file.less";

Upvotes: 3

jonschlinkert
jonschlinkert

Reputation: 11007

Based on the example you gave, make sure all of the files are in the same folder. Otherwise it won't work unless you either:

  • change the paths in the @import statements to point to the location of the files, or
  • use a compiler such as assemble-less to define the path(s) the the imported files

Upvotes: 0

Related Questions