less 1.7.0 → 1.7.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.grunt/grunt-contrib-jasmine/es5-shim.js +1360 -0
- package/.idea/jsLibraryMappings.xml +0 -1
- package/.idea/workspace.xml +182 -183
- package/.travis.yml +0 -1
- package/CHANGELOG.md +60 -2
- package/CONTRIBUTING.md +1 -1
- package/Gruntfile.js +12 -24
- package/LICENSE +0 -2
- package/README.md +5 -3
- package/benchmark/less-benchmark.js +1 -2
- package/bin/lessc +13 -11
- package/bower.json +2 -2
- package/build/rhino-modules.js +1 -1
- package/dist/less-1.7.0.js +59 -59
- package/dist/less-1.7.0.min.js +12 -12
- package/dist/less-1.7.1.js +7936 -0
- package/dist/less-1.7.1.min.js +16 -0
- package/dist/less-1.7.2.js +7938 -0
- package/dist/less-1.7.2.min.js +16 -0
- package/dist/less-1.7.3.js +7942 -0
- package/dist/less-1.7.3.min.js +16 -0
- package/dist/less-1.7.4.js +7979 -0
- package/dist/less-1.7.4.min.js +16 -0
- package/dist/less-1.7.5.js +8008 -0
- package/dist/less-1.7.5.min.js +16 -0
- package/dist/less-rhino-1.7.0.js +48 -48
- package/dist/less-rhino-1.7.1.js +9311 -0
- package/dist/less-rhino-1.7.2.js +9313 -0
- package/dist/less-rhino-1.7.3.js +9317 -0
- package/dist/less-rhino-1.7.4.js +9354 -0
- package/dist/less-rhino-1.7.5.js +9383 -0
- package/dist/lessc-rhino-1.7.0.js +2 -2
- package/dist/lessc-rhino-1.7.1.js +449 -0
- package/dist/lessc-rhino-1.7.2.js +449 -0
- package/dist/lessc-rhino-1.7.3.js +449 -0
- package/dist/lessc-rhino-1.7.4.js +449 -0
- package/dist/lessc-rhino-1.7.5.js +449 -0
- package/lib/less/browser.js +14 -9
- package/lib/less/env.js +2 -0
- package/lib/less/fs.js +10 -0
- package/lib/less/functions.js +41 -38
- package/lib/less/import-visitor.js +9 -7
- package/lib/less/index.js +30 -18
- package/lib/less/lessc_helper.js +1 -0
- package/lib/less/parser/parser.js.orig +1747 -0
- package/lib/less/parser.js +81 -40
- package/lib/less/rhino.js +3 -3
- package/lib/less/source-map-output.js +1 -1
- package/lib/less/to-css-visitor.js +3 -0
- package/lib/less/tree/anonymous.js +7 -3
- package/lib/less/tree/directive.js +6 -0
- package/lib/less/tree/element.js +6 -22
- package/lib/less/tree/import.js +1 -1
- package/lib/less/tree/mixin.js +4 -3
- package/lib/less/tree/quoted.js +12 -4
- package/lib/less/tree/rule.js +7 -4
- package/lib/less/tree/rule.js.orig +164 -0
- package/lib/less/tree/ruleset.js +27 -2
- package/lib/less/tree/selector.js +1 -1
- package/lib/less/tree.js +2 -2
- package/package.json +13 -12
- package/test/browser/less.js +7317 -6931
- package/test/css/comments.css +8 -0
- package/test/css/css-3.css +9 -0
- package/test/css/functions.css +8 -8
- package/test/css/import-inline.css +4 -1
- package/test/css/import.css +6 -0
- package/test/css/javascript.css +5 -0
- package/test/css/mixins-guards.css +14 -3
- package/test/css/mixins.css +3 -0
- package/test/css/property-name-interp.css +1 -0
- package/test/css/urls.css +6 -0
- package/test/index.js +1 -1
- package/test/less/comments.less +14 -1
- package/test/less/css-3.less +12 -1
- package/test/less/errors/color-invalid-hex-code.less +3 -0
- package/test/less/errors/color-invalid-hex-code.txt +4 -0
- package/test/less/errors/color-invalid-hex-code2.less +3 -0
- package/test/less/errors/color-invalid-hex-code2.txt +4 -0
- package/test/less/errors/import-malformed.less +1 -0
- package/test/less/errors/import-malformed.txt +3 -0
- package/test/less/errors/import-no-semi.txt +1 -1
- package/test/less/errors/javascript-error.less +1 -1
- package/test/less/errors/javascript-error.txt +2 -2
- package/test/less/import-inline.less +1 -0
- package/test/less/import.less +8 -1
- package/test/less/javascript.less +9 -0
- package/test/less/mixins-guards.less +17 -3
- package/test/less/mixins.less +4 -0
- package/test/less/property-name-interp.less +4 -1
- package/test/less/property-name-interp.less.orig +59 -0
- package/test/less/urls.less +12 -0
- package/test/less-test.js +7 -8
- package/test/modify-vars.js +17 -0
- package/test/sourcemaps/basic.json +1 -1
- package/tmp/browser/test-runner-main.html +4 -0
- package/tmp/less.js +8295 -0
- package/build/README.md +0 -51
- package/tmp/browser/test-postProcessor.html +0 -59
- package/tmp/browser/test-runner-browser.html +0 -59
- package/tmp/browser/test-runner-errors.html +0 -267
- package/tmp/browser/test-runner-global-vars.html +0 -59
- package/tmp/browser/test-runner-legacy.html +0 -59
- package/tmp/browser/test-runner-modify-vars.html +0 -59
- package/tmp/browser/test-runner-no-js-errors.html +0 -59
- package/tmp/browser/test-runner-production.html +0 -55
- package/tmp/browser/test-runner-relative-urls.html +0 -59
- package/tmp/browser/test-runner-rootpath-relative.html +0 -59
- package/tmp/browser/test-runner-rootpath.html +0 -59
|
@@ -0,0 +1,164 @@
|
|
|
1
|
+
var Node = require("./node.js"),
|
|
2
|
+
Value = require("./value.js"),
|
|
3
|
+
Keyword = require("./keyword.js");
|
|
4
|
+
|
|
5
|
+
<<<<<<< HEAD
|
|
6
|
+
var Rule = function (name, value, important, merge, index, currentFileInfo, inline) {
|
|
7
|
+
=======
|
|
8
|
+
tree.Rule = function (name, value, important, merge, index, currentFileInfo, inline, variable) {
|
|
9
|
+
>>>>>>> origin/master
|
|
10
|
+
this.name = name;
|
|
11
|
+
this.value = (value instanceof Node) ? value : new(Value)([value]); //value instanceof tree.Value || value instanceof tree.Ruleset ??
|
|
12
|
+
this.important = important ? ' ' + important.trim() : '';
|
|
13
|
+
this.merge = merge;
|
|
14
|
+
this.index = index;
|
|
15
|
+
this.currentFileInfo = currentFileInfo;
|
|
16
|
+
this.inline = inline || false;
|
|
17
|
+
this.variable = (variable !== undefined) ? variable
|
|
18
|
+
: (name.charAt && (name.charAt(0) === '@'));
|
|
19
|
+
};
|
|
20
|
+
|
|
21
|
+
<<<<<<< HEAD
|
|
22
|
+
=======
|
|
23
|
+
tree.Rule.prototype = {
|
|
24
|
+
type: "Rule",
|
|
25
|
+
accept: function (visitor) {
|
|
26
|
+
this.value = visitor.visit(this.value);
|
|
27
|
+
},
|
|
28
|
+
genCSS: function (env, output) {
|
|
29
|
+
output.add(this.name + (env.compress ? ':' : ': '), this.currentFileInfo, this.index);
|
|
30
|
+
try {
|
|
31
|
+
this.value.genCSS(env, output);
|
|
32
|
+
}
|
|
33
|
+
catch(e) {
|
|
34
|
+
e.index = this.index;
|
|
35
|
+
e.filename = this.currentFileInfo.filename;
|
|
36
|
+
throw e;
|
|
37
|
+
}
|
|
38
|
+
output.add(this.important + ((this.inline || (env.lastRule && env.compress)) ? "" : ";"), this.currentFileInfo, this.index);
|
|
39
|
+
},
|
|
40
|
+
toCSS: tree.toCSS,
|
|
41
|
+
eval: function (env) {
|
|
42
|
+
var strictMathBypass = false, name = this.name, variable = this.variable, evaldValue;
|
|
43
|
+
if (typeof name !== "string") {
|
|
44
|
+
// expand 'primitive' name directly to get
|
|
45
|
+
// things faster (~10% for benchmark.less):
|
|
46
|
+
name = (name.length === 1)
|
|
47
|
+
&& (name[0] instanceof tree.Keyword)
|
|
48
|
+
? name[0].value : evalName(env, name);
|
|
49
|
+
variable = false; // never treat expanded interpolation as new variable name
|
|
50
|
+
}
|
|
51
|
+
if (name === "font" && !env.strictMath) {
|
|
52
|
+
strictMathBypass = true;
|
|
53
|
+
env.strictMath = true;
|
|
54
|
+
}
|
|
55
|
+
try {
|
|
56
|
+
evaldValue = this.value.eval(env);
|
|
57
|
+
|
|
58
|
+
if (!this.variable && evaldValue.type === "DetachedRuleset") {
|
|
59
|
+
throw { message: "Rulesets cannot be evaluated on a property.",
|
|
60
|
+
index: this.index, filename: this.currentFileInfo.filename };
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
return new(tree.Rule)(name,
|
|
64
|
+
evaldValue,
|
|
65
|
+
this.important,
|
|
66
|
+
this.merge,
|
|
67
|
+
this.index, this.currentFileInfo, this.inline,
|
|
68
|
+
variable);
|
|
69
|
+
}
|
|
70
|
+
catch(e) {
|
|
71
|
+
if (typeof e.index !== 'number') {
|
|
72
|
+
e.index = this.index;
|
|
73
|
+
e.filename = this.currentFileInfo.filename;
|
|
74
|
+
}
|
|
75
|
+
throw e;
|
|
76
|
+
}
|
|
77
|
+
finally {
|
|
78
|
+
if (strictMathBypass) {
|
|
79
|
+
env.strictMath = false;
|
|
80
|
+
}
|
|
81
|
+
}
|
|
82
|
+
},
|
|
83
|
+
makeImportant: function () {
|
|
84
|
+
return new(tree.Rule)(this.name,
|
|
85
|
+
this.value,
|
|
86
|
+
"!important",
|
|
87
|
+
this.merge,
|
|
88
|
+
this.index, this.currentFileInfo, this.inline);
|
|
89
|
+
}
|
|
90
|
+
};
|
|
91
|
+
|
|
92
|
+
>>>>>>> origin/master
|
|
93
|
+
function evalName(env, name) {
|
|
94
|
+
var value = "", i, n = name.length,
|
|
95
|
+
output = {add: function (s) {value += s;}};
|
|
96
|
+
for (i = 0; i < n; i++) {
|
|
97
|
+
name[i].eval(env).genCSS(env, output);
|
|
98
|
+
}
|
|
99
|
+
return value;
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
Rule.prototype = new Node();
|
|
103
|
+
Rule.prototype.type = "Rule";
|
|
104
|
+
Rule.prototype.genCSS = function (env, output) {
|
|
105
|
+
output.add(this.name + (env.compress ? ':' : ': '), this.currentFileInfo, this.index);
|
|
106
|
+
try {
|
|
107
|
+
this.value.genCSS(env, output);
|
|
108
|
+
}
|
|
109
|
+
catch(e) {
|
|
110
|
+
e.index = this.index;
|
|
111
|
+
e.filename = this.currentFileInfo.filename;
|
|
112
|
+
throw e;
|
|
113
|
+
}
|
|
114
|
+
output.add(this.important + ((this.inline || (env.lastRule && env.compress)) ? "" : ";"), this.currentFileInfo, this.index);
|
|
115
|
+
};
|
|
116
|
+
Rule.prototype.eval = function (env) {
|
|
117
|
+
var strictMathBypass = false, name = this.name, evaldValue;
|
|
118
|
+
if (typeof name !== "string") {
|
|
119
|
+
// expand 'primitive' name directly to get
|
|
120
|
+
// things faster (~10% for benchmark.less):
|
|
121
|
+
name = (name.length === 1)
|
|
122
|
+
&& (name[0] instanceof Keyword)
|
|
123
|
+
? name[0].value : evalName(env, name);
|
|
124
|
+
}
|
|
125
|
+
if (name === "font" && !env.strictMath) {
|
|
126
|
+
strictMathBypass = true;
|
|
127
|
+
env.strictMath = true;
|
|
128
|
+
}
|
|
129
|
+
try {
|
|
130
|
+
evaldValue = this.value.eval(env);
|
|
131
|
+
|
|
132
|
+
if (!this.variable && evaldValue.type === "DetachedRuleset") {
|
|
133
|
+
throw { message: "Rulesets cannot be evaluated on a property.",
|
|
134
|
+
index: this.index, filename: this.currentFileInfo.filename };
|
|
135
|
+
}
|
|
136
|
+
|
|
137
|
+
return new(Rule)(name,
|
|
138
|
+
evaldValue,
|
|
139
|
+
this.important,
|
|
140
|
+
this.merge,
|
|
141
|
+
this.index, this.currentFileInfo, this.inline);
|
|
142
|
+
}
|
|
143
|
+
catch(e) {
|
|
144
|
+
if (typeof e.index !== 'number') {
|
|
145
|
+
e.index = this.index;
|
|
146
|
+
e.filename = this.currentFileInfo.filename;
|
|
147
|
+
}
|
|
148
|
+
throw e;
|
|
149
|
+
}
|
|
150
|
+
finally {
|
|
151
|
+
if (strictMathBypass) {
|
|
152
|
+
env.strictMath = false;
|
|
153
|
+
}
|
|
154
|
+
}
|
|
155
|
+
};
|
|
156
|
+
Rule.prototype.makeImportant = function () {
|
|
157
|
+
return new(Rule)(this.name,
|
|
158
|
+
this.value,
|
|
159
|
+
"!important",
|
|
160
|
+
this.merge,
|
|
161
|
+
this.index, this.currentFileInfo, this.inline);
|
|
162
|
+
};
|
|
163
|
+
|
|
164
|
+
module.exports = Rule;
|
package/lib/less/tree/ruleset.js
CHANGED
|
@@ -266,6 +266,7 @@ tree.Ruleset.prototype = {
|
|
|
266
266
|
},
|
|
267
267
|
genCSS: function (env, output) {
|
|
268
268
|
var i, j,
|
|
269
|
+
charsetRuleNodes = [],
|
|
269
270
|
ruleNodes = [],
|
|
270
271
|
rulesetNodes = [],
|
|
271
272
|
rulesetNodeCnt,
|
|
@@ -283,14 +284,38 @@ tree.Ruleset.prototype = {
|
|
|
283
284
|
tabSetStr = env.compress ? '' : Array(env.tabLevel).join(" "),
|
|
284
285
|
sep;
|
|
285
286
|
|
|
287
|
+
function isRulesetLikeNode(rule, root) {
|
|
288
|
+
// if it has nested rules, then it should be treated like a ruleset
|
|
289
|
+
if (rule.rules)
|
|
290
|
+
return true;
|
|
291
|
+
|
|
292
|
+
// medias and comments do not have nested rules, but should be treated like rulesets anyway
|
|
293
|
+
if ( (rule instanceof tree.Media) || (root && rule instanceof tree.Comment))
|
|
294
|
+
return true;
|
|
295
|
+
|
|
296
|
+
// some directives and anonumoust nodes are ruleset like, others are not
|
|
297
|
+
if ((rule instanceof tree.Directive) || (rule instanceof tree.Anonymous)) {
|
|
298
|
+
return rule.isRulesetLike();
|
|
299
|
+
}
|
|
300
|
+
|
|
301
|
+
//anything else is assumed to be a rule
|
|
302
|
+
return false;
|
|
303
|
+
}
|
|
304
|
+
|
|
286
305
|
for (i = 0; i < this.rules.length; i++) {
|
|
287
306
|
rule = this.rules[i];
|
|
288
|
-
if (
|
|
307
|
+
if (isRulesetLikeNode(rule, this.root)) {
|
|
289
308
|
rulesetNodes.push(rule);
|
|
290
309
|
} else {
|
|
291
|
-
|
|
310
|
+
//charsets should float on top of everything
|
|
311
|
+
if (rule.isCharset && rule.isCharset()) {
|
|
312
|
+
charsetRuleNodes.push(rule);
|
|
313
|
+
} else {
|
|
314
|
+
ruleNodes.push(rule);
|
|
315
|
+
}
|
|
292
316
|
}
|
|
293
317
|
}
|
|
318
|
+
ruleNodes = charsetRuleNodes.concat(ruleNodes);
|
|
294
319
|
|
|
295
320
|
// If this is the root node, we don't render
|
|
296
321
|
// a selector, or {}.
|
package/lib/less/tree.js
CHANGED
|
@@ -43,9 +43,9 @@ tree.find = function (obj, fun) {
|
|
|
43
43
|
|
|
44
44
|
tree.jsify = function (obj) {
|
|
45
45
|
if (Array.isArray(obj.value) && (obj.value.length > 1)) {
|
|
46
|
-
return '[' + obj.value.map(function (v) { return v.toCSS(
|
|
46
|
+
return '[' + obj.value.map(function (v) { return v.toCSS(); }).join(', ') + ']';
|
|
47
47
|
} else {
|
|
48
|
-
return obj.toCSS(
|
|
48
|
+
return obj.toCSS();
|
|
49
49
|
}
|
|
50
50
|
};
|
|
51
51
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "less",
|
|
3
|
-
"version": "1.7.
|
|
3
|
+
"version": "1.7.5",
|
|
4
4
|
"description": "Leaner CSS",
|
|
5
5
|
"homepage": "http://lesscss.org",
|
|
6
6
|
"author": {
|
|
@@ -31,7 +31,7 @@
|
|
|
31
31
|
"test": "./test"
|
|
32
32
|
},
|
|
33
33
|
"jam": {
|
|
34
|
-
"main": "./dist/less-1.
|
|
34
|
+
"main": "./dist/less-1.7.5.js"
|
|
35
35
|
},
|
|
36
36
|
"engines": {
|
|
37
37
|
"node": ">=0.8.0"
|
|
@@ -40,25 +40,26 @@
|
|
|
40
40
|
"test": "grunt test"
|
|
41
41
|
},
|
|
42
42
|
"optionalDependencies": {
|
|
43
|
-
"
|
|
44
|
-
"
|
|
45
|
-
"
|
|
46
|
-
"
|
|
43
|
+
"graceful-fs": "~3.0.2",
|
|
44
|
+
"mime": "~1.2.11",
|
|
45
|
+
"request": "~2.40.0",
|
|
46
|
+
"mkdirp": "~0.5.0",
|
|
47
|
+
"clean-css": "2.2.x",
|
|
47
48
|
"source-map": "0.1.x"
|
|
48
49
|
},
|
|
49
50
|
"devDependencies": {
|
|
50
51
|
"diff": "~1.0",
|
|
51
52
|
"grunt": "~0.4.2",
|
|
52
53
|
"grunt-contrib-clean": "~0.5.0",
|
|
53
|
-
"grunt-contrib-concat": "~0.
|
|
54
|
-
"grunt-contrib-connect": "~0.
|
|
54
|
+
"grunt-contrib-concat": "~0.4.0",
|
|
55
|
+
"grunt-contrib-connect": "~0.7.0",
|
|
55
56
|
"grunt-contrib-jasmine": "~0.5.2",
|
|
56
|
-
"grunt-contrib-jshint": "~0.
|
|
57
|
-
"grunt-contrib-uglify": "~0.
|
|
58
|
-
"grunt-shell": "~0.
|
|
57
|
+
"grunt-contrib-jshint": "~0.10.0",
|
|
58
|
+
"grunt-contrib-uglify": "~0.4.0",
|
|
59
|
+
"grunt-shell": "~0.7.0",
|
|
59
60
|
"http-server": "~0.6.1",
|
|
60
61
|
"matchdep": "~0.3.0",
|
|
61
|
-
"time-grunt": "~0.
|
|
62
|
+
"time-grunt": "~0.3.1"
|
|
62
63
|
},
|
|
63
64
|
"keywords": [
|
|
64
65
|
"compile less",
|