0

I'm trying to compile 2 less files using lessc for nodejs.

my files are organized in this order:

lessc file is in C:\test\less\bin, test.less and all.less files are in C:\test\css

my lessc command line is:

lessc --include-path="..\..\test" "C:\test\css\all.less" "C:\test\css\all.css"

My all.less file is as follows:

@import: ".\test.less";

.transition(@transition) {
    weight: 1px+1em;
  -webkit-transition: @transition;
-moz-transition: @transition;
-o-transition: @transition;
transition: @transition;
}
.opacity(@opacity) {
  opacity: @opacity / 100;
  filter: ~"alpha(opacity=@{opacity})";
}

a {
.transition(all 0.4s) ;
&:hover {
  .opacity(70);
  .testClass;
  }
}

// Selector interpolation only works in 1.3.1+. Try it!
@theGoodThings: ~".food, .beer, .sleep, .javascript";

@{theGoodThings} {
  font-weight: bold;
  size: 50px;
  filter: e("ms:alwaysHasItsOwnSyntax.For.Stuff()");
}

and test.less file is as follows:

.testClass {
    content: replace("Hello, Mars?", "Mars\?", "Earth!");
    content: replace("One + one = 4", "one", "2", "gi");
    content: replace('This is a string.', "(string)\.$", "new $1.");
    content: replace(~"bar-1", '1', '2');
}

The problem is when i run the command, all i get is and error explaining the .testClass is undefined

NameError: .testClass is undefined in C:\test\css\all.less on line 19, column 3:

18   .opacity(70);
19   .testClass;
20   }

I tries any argument and even tried to debug the lessc code but couldn't come up with any solution. It seems like the @import of test.less file in the all.less file is ignored during the compilation and can't find the .testClass class in the test.less file.

What am I missing? am I using the wrong arguments?

Amit Ben Ami
  • 548
  • 2
  • 6
  • 21

1 Answers1

0

Answer:

I found out the problem. in the all.less file my import of the test.less file is

@import: ".\test.less"

When it should be (Note the missing ':')

@import ".\test.less"
Amit Ben Ami
  • 548
  • 2
  • 6
  • 21