Problem about multi-less files and import, less.js v1.1.5

8 views
Skip to first unread message

IL

unread,
Nov 15, 2011, 12:52:56 AM11/15/11
to LESS - Leaner CSS
Now I have three less files. When I put them all together and try it
at http://www.dopefly.com/LESS-Converter/less-converter.html . It's
generated the right css well.
But when I link these three less files in the head. I got
".colorScheme is undefined"

There are more complex pages, with more less files, and them import
others.

I cannot put them all in one less files, since some linked less files
may be changed via javascript.

Any suggestion?


Here is my <head>

<head>
<link type="text/css" rel="stylesheet/less" href="/less/
schemebase.less">
<link type="text/css" rel="stylesheet/less" href="/schemedefault/
General.less">
<link type="text/css" rel="stylesheet/less" href="/schemesetting/
General.less">
<script src="http://lesscss.googlecode.com/files/
less-1.1.5.min.js"></script>
</head>


"/less/schemebase.less"
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
#common {
.color(@color) {
color:~`'#'+(@{color}).toString(16)`;
}
.background-color(@color) {
background-color:~`'#'+(@{color}).toString(16)`;
}

.text-decoration(@line, @color) {
@colorCode:~`'#'+(@{color}).toString(16)`;
text-decoration:@line;
text-decoration-line:@line;
text-decoration-color:@colorCode;
-moz-text-decoration-line:@line;
-moz-text-decoration-color:@colorCode;
}

.text-decoration(@line, @color, @style) {
.text-decoration(@line, @color);
text-decoration-style:@style;
-moz-text-decoration-style:@style;
}

.line-underscore(@color) {
.text-decoration(underline, @color);
}

.wave-underscore(@color) {
.text-decoration(underline, @color, wavy)
}

.boxed(@color) {
border: solid ~`'#'+(@{color}).toString(16)`;
}

.strikeout(@color) {
.text-decoration(line-through, @color);
}

.bold-line-underscore(@color) {
.text-decoration(underline, @color, double);
}

.bold-dotted-line(@color) {
.text-decoration(underline, @color, dotted);
}

.search-match(@color) {
// todo: not implement.
}

.rounded-box(@color) {
.boxed(@color);
border-radius:10px;
}
}

#schemebase {
.color(@color, 0) {
#common .color(@color)
}

.color(@color, 1) {
#common .background-color(@color)
}

.color() {}

.foregroundColor(@color, 1) {
#common .color(@color)
}

.foregroundColor(@color) {
@isDefined: `(@{color} >= 0)`;
.foregroundColor(@color, @isDefined);
}

.foregroundColor() {}

.backgroundColor(@color, 1) {
#common .background-color(@color)
}

.backgroundColor(@color) {
@isDefined:`(@{color} >= 0)`;
.backgroundColor(@color, @isDefined);
}

.backgroundColor() {}

// LINE_UNDERSCORE
.effect(@color, 0, 1) {
#common .line-underscore(@color);
}

// WAVE_UNDERSCORE
.effect(@color, 1, 1) {
#common .wave-underscore(@color);
}

// BOXED
.effect(@color, 2, 1) {
#common .boxed(@color);
}

// STRIKEOUT
.effect(@color, 3, 1) {
#common .strikeout(@color);
}

// BOLD_LINE_UNDERSCORE
.effect(@color, 4, 1) {
#common .bold-line-underscore(@color);
}

// BOLD_DOTTED_LINE
.effect(@color, 5, 1) {
#common .bold-dotted-line(@color);
}

// SEARCH_MATCH
.effect(@color, 6, 1) {
#common .search-match(@color);
}

// ROUNDED_BOX
.effect(@color, 7, 1) {
#common .rounded-box(@color);
}

.effect(@color, @type) {
@isDefined:`(@{color} >= 0)`;
.effect(@color, @type, @isDefined);
}

.effect() {}

// PLAIN
.fontType(0) {}

// ITALIC
.fontType(1) {
font-style:italic;
}

// BOLD
.fontType(2) {
font-weight:bold;
}

// BOLD_ITALIC
.fontType(3) {
.fontType(1);
.fontType(2);
}

.fontType() {}

.errorStripe(@color) {
// todo: not implement
}

.attribute(@foregroundColor, @backgroundColor, @effectColor,
@effectType, @fontType, @errorStripeColor) {
.foregroundColor(@foregroundColor);
.backgroundColor(@backgroundColor);
.effect(@effectColor, @effectType);
.fontType(@fontType);
.errorStripe(@errorStripeColor);
}

.editorFontName(@name) {
font-family:@name;
}

.editorFontSize(@size) {
font-size:~"@{size}px";
}

.lineSpacing(@x) {
line-height:@x * 1.2;
}

.quickDocFontSize() {}

.selection(@foregroundColor, @backgroundColor) {
::selection {
.foregroundColor(@foregroundColor);
.backgroundColor(@backgroundColor);
}
::-moz-selection{
.foregroundColor(@foregroundColor);
.backgroundColor(@backgroundColor);
}
}
}

///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////













"/schemedefault/General.less"
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

#FY3tP7Nhjzt2fgrjIE1gP2C6Hmo{.editorFontName()
{#schemebase .editorFontName("Monospaced")}.editorFontSize()
{#schemebase .editorFontSize(12)}.lineSpacing()
{#schemebase .lineSpacing(1.0)}.color(@key,@kind){.color(@key,@kind,
0)}.color(){}.attribute(29,1)
{#schemebase .attribute(127,-1,-1,-1,-1,-1)}.attribute(30,1)
{#schemebase .attribute(8421504,-1,-1,-1,-1,-1)}.attribute(31,1)
{#schemebase .attribute(12829635,15790320,-1,-1,1,-1)}.attribute(32,1)
{#schemebase .attribute(-1,13421823,-1,-1,-1,-1)}.attribute(33,1)
{#schemebase .attribute(16777164,-1,-1,-1,1,-1)}.attribute(34,1)
{#schemebase .attribute(-1,16119792,-1,-1,-1,-1)}.attribute(35,1)
{#schemebase .attribute(-1,10079487,-1,-1,-1,-1)}.attribute(36,1)
{#schemebase .attribute(16711680,-1,-1,-1,-1,-1)}.attribute(37,1)
{#schemebase .attribute(255,15329769,255,0,2,-1)}.attribute(38,1)
{#schemebase .attribute(8323072,-1,-1,-1,3,-1)}.attribute(39,1)
{#schemebase .attribute(-1,15596781,-1,-1,-1,-1)}.attribute(40,1)
{#schemebase .attribute(-1,16768220,-1,-1,-1,-1)}.attribute(41,1)
{#schemebase .attribute(-1,-1,16029712,1,-1,16029712)}.attribute(42,1)
{#schemebase .attribute(0,-1,-1,-1,-1,-1)}.attribute(43,1)
{#schemebase .attribute(-1,16764415,-1,-1,-1,-1)}.attribute(44,1)
{#schemebase .attribute(-1,15000831,-1,-1,-1,13421823)}.attribute(45,1)
{#schemebase .attribute(8323072,-1,-1,-1,-1,-1)}.attribute(46,1)
{#schemebase .attribute(255,-1,-1,-1,3,255)}.attribute(47,1)
{#schemebase .attribute(32512,-1,-1,-1,2,-1)}.attribute(48,1)
{#schemebase .attribute(-1,-1,16711680,1,-1,16711680)}.attribute(49,1)
{#schemebase .attribute(-1,16770303,-1,-1,-1,16764415)}.attribute(50,1)
{#schemebase .attribute(13434828,-1,-1,-1,1,-1)}.attribute(51,1)
{#schemebase .attribute(255,-1,255,0,2,-1)}.attribute(52,1)
{#schemebase .attribute(-1,16776960,-1,-1,-1,65280)}.attribute(53,1)
{#schemebase .attribute(-1,-1,32768,1,-1,-1)}.attribute(54,1)
{#schemebase .attribute(-1,16182204,-1,-1,-1,16776960)}.attribute(55,1)
{#schemebase .attribute(16764108,-1,-1,-1,1,-1)}.attribute(56,1)
{#schemebase .attribute(-1,-1,13421772,1,-1,16777164)}.attribute(57,1)
{#schemebase .attribute(-1,-1,4210752,3,-1,-1)}.attribute(@key)
{@flag:`@{key}==34||@{key}==52||@{key}==45||@{key}==39||@{key}==30||
@{key}==56||@{key}==41||@{key}==38||@{key}==49||@{key}==42||@{key}
==53||@{key}==31||@{key}==48||@{key}==37||@{key}==47||@{key}==33||
@{key}==36||@{key}==44||@{key}==54||@{key}==55||@{key}==50||@{key}
==43||@{key}==32||@{key}==51||@{key}==35||@{key}==57||@{key}==46||
@{key}==40||@{key}==29`;.attribute(@key,@flag)}.attribute()
{}.colorScheme(1){#scheme .colorScheme}}#schemedefault{.color()
{#FY3tP7Nhjzt2fgrjIE1gP2C6Hmo .color(@arguments)}.attribute()
{#FY3tP7Nhjzt2fgrjIE1gP2C6Hmo .attribute(@arguments)}.editorFontName()
{#FY3tP7Nhjzt2fgrjIE1gP2C6Hmo .editorFontName(@arguments)}.editorFontSize()
{#FY3tP7Nhjzt2fgrjIE1gP2C6Hmo .editorFontSize(@arguments)}.lineSpacing()
{#FY3tP7Nhjzt2fgrjIE1gP2C6Hmo .lineSpacing(@arguments)}}.colorScheme(@main)
{@flag:`@{main}
=="FY3tP7Nhjzt2fgrjIE1gP2C6Hmo"`;#FY3tP7Nhjzt2fgrjIE1gP2C6Hmo .colorScheme(@flag)}
@mainScheme:"FY3tP7Nhjzt2fgrjIE1gP2C6Hmo";

///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////












"/schemesetting/General.less"

///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

#scheme{.colorScheme()
{.attribute(58);.lineSpacing();*{.editorFontName();.editorFontSize();}.code1n{.color(59,1)}.code1o{.color(60,1)}.code1p{.color(61,1)}.code1q{.color(62,0)}.code1r{.color(63,1)}.code1s{.color(64,1)}.code1t{.color(65,0)}.code1u{.color(66,1)}.code1v{.color(67,1)}.code1w{.color(68,1)}.code1x{.color(69,0)}.code1y{.color(70,0)}.code1z{.color(71,1)}.code20{.color(72,1)}.code21{.color(73,0)}.code22{.color(74,0)}.code23{.color(75,1)}.code24{.color(76,0)}.code25{.color(77,1)}.code26{.color(78,0)}.code27{.color(79,0)}.code28{.color(80,0)}.codet{.attribute(29)}.codeu{.attribute(30)}.codev{.attribute(31)}.codew{.attribute(32)}.codex{.attribute(33)}.codey{.attribute(34)}.codez{.attribute(35)}.code10{.attribute(36)}.code11{.attribute(37)}.code12{.attribute(38)}.code13{.attribute(39)}.code14{.attribute(40)}.code15{.attribute(41)}.code16{.attribute(42)}.code17{.attribute(43)}.code18{.attribute(44)}.code19{.attribute(45)}.code1a{.attribute(46)}.code1b{.attribute(47)}.code1m{.attribute(58)}.code1c{.attribute(48)}.code1d{.attribute(49)}.code1e{.attribute(50)}.code1f{.attribute(51)}.code1g{.attribute(52)}.code1h{.attribute(53)}.code1i{.attribute(54)}.code1j{.attribute(55)}.code1k{.attribute(56)}.code1l{.attribute(57)}}}.democode{.colorScheme(@mainScheme)}

///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
Reply all
Reply to author
Forward
0 new messages