0
我想使用lessc爲nodejs編譯少於2個的文件。使用lessc編譯.less文件
我的文件組織順序是:
lessc文件是C:\測試\少\ BIN,test.less和all.less文件都在C:\測試\ CSS
我lessc命令行是:
lessc --include-path="..\..\test" "C:\test\css\all.less" "C:\test\css\all.css"
我all.less文件如下:
@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([email protected]{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()");
}
和test.less文件如下:
.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');
}
問題是,當我運行的命令,我得到的是和錯誤解釋.testClass是不確定的
NameError: .testClass is undefined in C:\test\css\all.less on line 19, column 3:
18 .opacity(70);
19 .testClass;
20 }
我嘗試任何參數,甚至試圖調試lessc代碼,但無法提出任何解決方案。似乎在編譯期間,all.less文件中的test.less文件的@import被忽略,並且無法在test.less文件中找到.testClass類。
我缺少什麼?我是否使用了錯誤的參數?