less 2.3.1 → 2.4.0
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/.idea/workspace.xml +277 -237
- package/.jscsrc +36 -1
- package/.travis.yml +1 -0
- package/CHANGELOG.md +14 -0
- package/Gruntfile.js +1 -1
- package/appveyor.yml +5 -0
- package/bin/lessc +8 -5
- package/bower.json +1 -1
- package/dist/less.js +909 -814
- package/dist/less.min.js +6 -6
- package/lib/less/contexts.js +2 -2
- package/lib/less/environment/abstract-file-manager.js +6 -6
- package/lib/less/environment/environment.js +2 -2
- package/lib/less/functions/color.js +13 -5
- package/lib/less/functions/math.js +1 -1
- package/lib/less/functions/number.js +2 -2
- package/lib/less/functions/types.js +18 -8
- package/lib/less/import-manager.js +5 -5
- package/lib/less/index.js +1 -1
- package/lib/less/less-error.js +1 -1
- package/lib/less/logger.js +2 -2
- package/lib/less/parse-tree.js +45 -45
- package/lib/less/parse.js +5 -2
- package/lib/less/parser/parser-input.js +3 -3
- package/lib/less/parser/parser.js +52 -18
- package/lib/less/plugin-manager.js +30 -3
- package/lib/less/render.js +5 -2
- package/lib/less/source-map-builder.js +4 -0
- package/lib/less/source-map-output.js +3 -3
- package/lib/less/transform-tree.js +4 -4
- package/lib/less/tree/anonymous.js +1 -1
- package/lib/less/tree/call.js +1 -1
- package/lib/less/tree/color.js +2 -2
- package/lib/less/tree/condition.js +8 -4
- package/lib/less/tree/dimension.js +4 -4
- package/lib/less/tree/element.js +1 -1
- package/lib/less/tree/expression.js +1 -1
- package/lib/less/tree/extend.js +3 -3
- package/lib/less/tree/javascript.js +2 -2
- package/lib/less/tree/media.js +20 -20
- package/lib/less/tree/mixin-call.js +2 -2
- package/lib/less/tree/mixin-definition.js +29 -8
- package/lib/less/tree/quoted.js +3 -3
- package/lib/less/tree/rule.js +1 -1
- package/lib/less/tree/ruleset.js +35 -28
- package/lib/less/tree/selector.js +1 -1
- package/lib/less/tree/unit.js +2 -0
- package/lib/less/tree/value.js +1 -1
- package/lib/less/visitors/extend-visitor.js +15 -14
- package/lib/less/visitors/import-sequencer.js +2 -2
- package/lib/less/visitors/import-visitor.js +2 -2
- package/lib/less/visitors/to-css-visitor.js +5 -5
- package/lib/less-browser/cache.js +2 -2
- package/lib/less-browser/file-manager.js +96 -96
- package/lib/less-browser/index.js +205 -205
- package/lib/less-browser/log-listener.js +2 -2
- package/lib/less-browser/utils.js +6 -6
- package/lib/less-node/file-manager.js +9 -4
- package/lib/less-node/index.js +3 -3
- package/lib/less-node/plugin-loader.js +3 -3
- package/lib/less-node/url-file-manager.js +5 -2
- package/lib/less-rhino/index.js +13 -9
- package/lib/source-map/source-map-0.1.31.js +1 -1
- package/package.json +1 -1
- package/test/browser/css/relative-urls/urls.css +1 -0
- package/test/browser/less/relative-urls/urls.less +1 -0
- package/test/browser/runner-browser-options.js +23 -23
- package/test/browser/runner-errors-spec.js +1 -1
- package/test/browser/runner-global-vars-spec.js +1 -1
- package/test/browser/runner-main-options.js +5 -5
- package/test/browser/runner-main-spec.js +1 -1
- package/test/copy-bom.js +35 -35
- package/test/css/functions.css +8 -0
- package/test/css/import-interpolation.css +1 -0
- package/test/css/mixins-important.css +6 -0
- package/test/css/selectors.css +5 -0
- package/test/css/static-urls/urls.css +1 -0
- package/test/css/urls.css +1 -0
- package/test/index.js +2 -1
- package/test/less/functions.less +13 -0
- package/test/less/import/imports/logo.less +1 -0
- package/test/less/mixins-important.less +17 -1
- package/test/less/selectors.less +10 -0
- package/test/less/sourcemaps-empty/empty.less +0 -0
- package/test/less/sourcemaps-empty/var-defs.less +1 -0
- package/test/less/urls.less +1 -1
- package/test/less-test.js +49 -27
- package/test/modify-vars.js +13 -13
- package/test/browser/less.js +0 -29
- package/test/less-bom/charsets.less +0 -3
- package/test/less-bom/colors.less +0 -98
- package/test/less-bom/comments.less +0 -102
- package/test/less-bom/comments2.less +0 -20
- package/test/less-bom/compression/compression.less +0 -36
- package/test/less-bom/css-3.less +0 -154
- package/test/less-bom/css-escapes.less +0 -33
- package/test/less-bom/css-guards.less +0 -103
- package/test/less-bom/css.less +0 -108
- package/test/less-bom/debug/import/test.less +0 -25
- package/test/less-bom/debug/linenumbers.less +0 -33
- package/test/less-bom/detached-rulesets.less +0 -103
- package/test/less-bom/empty.less +0 -1
- package/test/less-bom/errors/add-mixed-units.less +0 -3
- package/test/less-bom/errors/add-mixed-units.txt +0 -4
- package/test/less-bom/errors/add-mixed-units2.less +0 -3
- package/test/less-bom/errors/add-mixed-units2.txt +0 -4
- package/test/less-bom/errors/at-rules-undefined-var.less +0 -4
- package/test/less-bom/errors/at-rules-undefined-var.txt +0 -4
- package/test/less-bom/errors/bad-variable-declaration1.less +0 -1
- package/test/less-bom/errors/bad-variable-declaration1.txt +0 -2
- package/test/less-bom/errors/color-func-invalid-color.less +0 -3
- package/test/less-bom/errors/color-func-invalid-color.txt +0 -4
- package/test/less-bom/errors/color-invalid-hex-code.less +0 -3
- package/test/less-bom/errors/color-invalid-hex-code.txt +0 -4
- package/test/less-bom/errors/color-invalid-hex-code2.less +0 -3
- package/test/less-bom/errors/color-invalid-hex-code2.txt +0 -4
- package/test/less-bom/errors/css-guard-default-func.less +0 -4
- package/test/less-bom/errors/css-guard-default-func.txt +0 -4
- package/test/less-bom/errors/detached-ruleset-1.less +0 -6
- package/test/less-bom/errors/detached-ruleset-1.txt +0 -4
- package/test/less-bom/errors/detached-ruleset-2.less +0 -6
- package/test/less-bom/errors/detached-ruleset-2.txt +0 -4
- package/test/less-bom/errors/detached-ruleset-3.less +0 -4
- package/test/less-bom/errors/detached-ruleset-3.txt +0 -4
- package/test/less-bom/errors/detached-ruleset-4.less +0 -5
- package/test/less-bom/errors/detached-ruleset-4.txt +0 -4
- package/test/less-bom/errors/detached-ruleset-5.less +0 -4
- package/test/less-bom/errors/detached-ruleset-5.txt +0 -3
- package/test/less-bom/errors/detached-ruleset-6.less +0 -5
- package/test/less-bom/errors/detached-ruleset-6.txt +0 -4
- package/test/less-bom/errors/divide-mixed-units.less +0 -3
- package/test/less-bom/errors/divide-mixed-units.txt +0 -4
- package/test/less-bom/errors/extend-no-selector.less +0 -3
- package/test/less-bom/errors/extend-no-selector.txt +0 -3
- package/test/less-bom/errors/extend-not-at-end.less +0 -3
- package/test/less-bom/errors/extend-not-at-end.txt +0 -3
- package/test/less-bom/errors/import-malformed.less +0 -1
- package/test/less-bom/errors/import-malformed.txt +0 -3
- package/test/less-bom/errors/import-missing.less +0 -6
- package/test/less-bom/errors/import-missing.txt +0 -3
- package/test/less-bom/errors/import-no-semi.less +0 -1
- package/test/less-bom/errors/import-no-semi.txt +0 -2
- package/test/less-bom/errors/import-subfolder1.less +0 -1
- package/test/less-bom/errors/import-subfolder1.txt +0 -3
- package/test/less-bom/errors/import-subfolder2.less +0 -1
- package/test/less-bom/errors/import-subfolder2.txt +0 -4
- package/test/less-bom/errors/imports/import-subfolder1.less +0 -1
- package/test/less-bom/errors/imports/import-subfolder2.less +0 -1
- package/test/less-bom/errors/imports/import-test.less +0 -4
- package/test/less-bom/errors/imports/subfolder/mixin-not-defined.less +0 -1
- package/test/less-bom/errors/imports/subfolder/parse-error-curly-bracket.less +0 -1
- package/test/less-bom/errors/javascript-error.less +0 -3
- package/test/less-bom/errors/javascript-error.txt +0 -4
- package/test/less-bom/errors/javascript-undefined-var.less +0 -3
- package/test/less-bom/errors/javascript-undefined-var.txt +0 -4
- package/test/less-bom/errors/mixed-mixin-definition-args-1.less +0 -6
- package/test/less-bom/errors/mixed-mixin-definition-args-1.txt +0 -4
- package/test/less-bom/errors/mixed-mixin-definition-args-2.less +0 -6
- package/test/less-bom/errors/mixed-mixin-definition-args-2.txt +0 -4
- package/test/less-bom/errors/mixin-not-defined.less +0 -11
- package/test/less-bom/errors/mixin-not-defined.txt +0 -3
- package/test/less-bom/errors/mixin-not-matched.less +0 -6
- package/test/less-bom/errors/mixin-not-matched.txt +0 -3
- package/test/less-bom/errors/mixin-not-matched2.less +0 -6
- package/test/less-bom/errors/mixin-not-matched2.txt +0 -3
- package/test/less-bom/errors/mixin-not-visible-in-scope-1.less +0 -9
- package/test/less-bom/errors/mixin-not-visible-in-scope-1.txt +0 -4
- package/test/less-bom/errors/mixins-guards-default-func-1.less +0 -9
- package/test/less-bom/errors/mixins-guards-default-func-1.txt +0 -4
- package/test/less-bom/errors/mixins-guards-default-func-2.less +0 -9
- package/test/less-bom/errors/mixins-guards-default-func-2.txt +0 -4
- package/test/less-bom/errors/mixins-guards-default-func-3.less +0 -9
- package/test/less-bom/errors/mixins-guards-default-func-3.txt +0 -4
- package/test/less-bom/errors/multiple-guards-on-css-selectors.less +0 -4
- package/test/less-bom/errors/multiple-guards-on-css-selectors.txt +0 -4
- package/test/less-bom/errors/multiple-guards-on-css-selectors2.less +0 -4
- package/test/less-bom/errors/multiple-guards-on-css-selectors2.txt +0 -4
- package/test/less-bom/errors/multiply-mixed-units.less +0 -7
- package/test/less-bom/errors/multiply-mixed-units.txt +0 -4
- package/test/less-bom/errors/parens-error-1.less +0 -3
- package/test/less-bom/errors/parens-error-1.txt +0 -4
- package/test/less-bom/errors/parens-error-2.less +0 -3
- package/test/less-bom/errors/parens-error-2.txt +0 -4
- package/test/less-bom/errors/parens-error-3.less +0 -3
- package/test/less-bom/errors/parens-error-3.txt +0 -4
- package/test/less-bom/errors/parse-error-curly-bracket.less +0 -4
- package/test/less-bom/errors/parse-error-curly-bracket.txt +0 -4
- package/test/less-bom/errors/parse-error-extra-parens.less +0 -5
- package/test/less-bom/errors/parse-error-extra-parens.txt +0 -3
- package/test/less-bom/errors/parse-error-missing-bracket.less +0 -2
- package/test/less-bom/errors/parse-error-missing-bracket.txt +0 -3
- package/test/less-bom/errors/parse-error-missing-parens.less +0 -5
- package/test/less-bom/errors/parse-error-missing-parens.txt +0 -3
- package/test/less-bom/errors/parse-error-with-import.less +0 -13
- package/test/less-bom/errors/parse-error-with-import.txt +0 -4
- package/test/less-bom/errors/percentage-missing-space.less +0 -3
- package/test/less-bom/errors/percentage-missing-space.txt +0 -4
- package/test/less-bom/errors/property-asterisk-only-name.less +0 -3
- package/test/less-bom/errors/property-asterisk-only-name.txt +0 -4
- package/test/less-bom/errors/property-ie5-hack.less +0 -3
- package/test/less-bom/errors/property-ie5-hack.txt +0 -3
- package/test/less-bom/errors/property-in-root.less +0 -4
- package/test/less-bom/errors/property-in-root.txt +0 -4
- package/test/less-bom/errors/property-in-root2.less +0 -1
- package/test/less-bom/errors/property-in-root2.txt +0 -4
- package/test/less-bom/errors/property-in-root3.less +0 -4
- package/test/less-bom/errors/property-in-root3.txt +0 -3
- package/test/less-bom/errors/property-interp-not-defined.less +0 -1
- package/test/less-bom/errors/property-interp-not-defined.txt +0 -2
- package/test/less-bom/errors/recursive-variable.less +0 -1
- package/test/less-bom/errors/recursive-variable.txt +0 -2
- package/test/less-bom/errors/single-character.less +0 -1
- package/test/less-bom/errors/single-character.txt +0 -2
- package/test/less-bom/errors/svg-gradient1.less +0 -3
- package/test/less-bom/errors/svg-gradient1.txt +0 -4
- package/test/less-bom/errors/svg-gradient2.less +0 -3
- package/test/less-bom/errors/svg-gradient2.txt +0 -4
- package/test/less-bom/errors/svg-gradient3.less +0 -3
- package/test/less-bom/errors/svg-gradient3.txt +0 -4
- package/test/less-bom/errors/unit-function.less +0 -3
- package/test/less-bom/errors/unit-function.txt +0 -4
- package/test/less-bom/extend-chaining.less +0 -91
- package/test/less-bom/extend-clearfix.less +0 -19
- package/test/less-bom/extend-exact.less +0 -46
- package/test/less-bom/extend-media.less +0 -24
- package/test/less-bom/extend-nest.less +0 -65
- package/test/less-bom/extend-selector.less +0 -99
- package/test/less-bom/extend.less +0 -81
- package/test/less-bom/extract-and-length.less +0 -133
- package/test/less-bom/functions.less +0 -201
- package/test/less-bom/globalVars/extended.json +0 -5
- package/test/less-bom/globalVars/extended.less +0 -10
- package/test/less-bom/globalVars/simple.json +0 -3
- package/test/less-bom/globalVars/simple.less +0 -3
- package/test/less-bom/ie-filters.less +0 -15
- package/test/less-bom/import/deeper/deeper-2/url-import-2.less +0 -3
- package/test/less-bom/import/deeper/deeper-2/url-import.less +0 -1
- package/test/less-bom/import/deeper/import-once-test-a.less +0 -1
- package/test/less-bom/import/deeper/url-import.less +0 -1
- package/test/less-bom/import/import-and-relative-paths-test.less +0 -17
- package/test/less-bom/import/import-charset-test.less +0 -1
- package/test/less-bom/import/import-interpolation.less +0 -2
- package/test/less-bom/import/import-interpolation2.less +0 -5
- package/test/less-bom/import/import-once-test-c.less +0 -6
- package/test/less-bom/import/import-reference.less +0 -89
- package/test/less-bom/import/import-test-a.less +0 -4
- package/test/less-bom/import/import-test-b.less +0 -8
- package/test/less-bom/import/import-test-c.less +0 -6
- package/test/less-bom/import/import-test-d.css +0 -1
- package/test/less-bom/import/import-test-e.less +0 -2
- package/test/less-bom/import/import-test-f.less +0 -5
- package/test/less-bom/import/imports/font.less +0 -8
- package/test/less-bom/import/imports/logo.less +0 -5
- package/test/less-bom/import/interpolation-vars.less +0 -6
- package/test/less-bom/import/invalid-css.less +0 -1
- package/test/less-bom/import/urls.less +0 -1
- package/test/less-bom/import-inline.less +0 -3
- package/test/less-bom/import-interpolation.less +0 -8
- package/test/less-bom/import-once.less +0 -6
- package/test/less-bom/import-reference.less +0 -23
- package/test/less-bom/import.less +0 -30
- package/test/less-bom/include-path/include-path.less +0 -6
- package/test/less-bom/javascript.less +0 -38
- package/test/less-bom/lazy-eval.less +0 -6
- package/test/less-bom/legacy/legacy.less +0 -7
- package/test/less-bom/media.less +0 -234
- package/test/less-bom/merge.less +0 -78
- package/test/less-bom/mixins-args.less +0 -215
- package/test/less-bom/mixins-closure.less +0 -26
- package/test/less-bom/mixins-guards-default-func.less +0 -195
- package/test/less-bom/mixins-guards.less +0 -271
- package/test/less-bom/mixins-important.less +0 -37
- package/test/less-bom/mixins-interpolated.less +0 -75
- package/test/less-bom/mixins-named-args.less +0 -36
- package/test/less-bom/mixins-nested.less +0 -22
- package/test/less-bom/mixins-pattern.less +0 -102
- package/test/less-bom/mixins.less +0 -145
- package/test/less-bom/modifyVars/extended.json +0 -5
- package/test/less-bom/modifyVars/extended.less +0 -11
- package/test/less-bom/nested-gradient-with-svg-gradient/mixin-consumer.less +0 -5
- package/test/less-bom/nested-gradient-with-svg-gradient/svg-gradient-mixin.less +0 -15
- package/test/less-bom/no-js-errors/no-js-errors.less +0 -3
- package/test/less-bom/no-js-errors/no-js-errors.txt +0 -4
- package/test/less-bom/no-output.less +0 -2
- package/test/less-bom/operations.less +0 -62
- package/test/less-bom/parens.less +0 -45
- package/test/less-bom/property-name-interp.less +0 -56
- package/test/less-bom/rulesets.less +0 -30
- package/test/less-bom/scope.less +0 -104
- package/test/less-bom/selectors.less +0 -174
- package/test/less-bom/sourcemaps/basic.json +0 -3
- package/test/less-bom/sourcemaps/basic.less +0 -27
- package/test/less-bom/sourcemaps/imported.css +0 -7
- package/test/less-bom/static-urls/urls.less +0 -33
- package/test/less-bom/strict-units/strict-units.less +0 -4
- package/test/less-bom/strings.less +0 -73
- package/test/less-bom/url-args/urls.less +0 -63
- package/test/less-bom/urls.less +0 -94
- package/test/less-bom/variables-in-at-rules.less +0 -20
- package/test/less-bom/variables.less +0 -119
- package/test/less-bom/whitespace.less +0 -44
package/lib/less-rhino/index.js
CHANGED
|
@@ -18,11 +18,11 @@ function formatError(ctx, options) {
|
|
|
18
18
|
return ctx.stack || ctx.message;
|
|
19
19
|
}
|
|
20
20
|
|
|
21
|
-
if (typeof
|
|
21
|
+
if (typeof extract[0] === 'string') {
|
|
22
22
|
error.push(stylize((ctx.line - 1) + ' ' + extract[0], 'grey'));
|
|
23
23
|
}
|
|
24
24
|
|
|
25
|
-
if (typeof
|
|
25
|
+
if (typeof extract[1] === 'string') {
|
|
26
26
|
var errorTxt = ctx.line + ' ';
|
|
27
27
|
if (extract[1]) {
|
|
28
28
|
errorTxt += extract[1].slice(0, ctx.column) +
|
|
@@ -32,14 +32,14 @@ function formatError(ctx, options) {
|
|
|
32
32
|
error.push(errorTxt);
|
|
33
33
|
}
|
|
34
34
|
|
|
35
|
-
if (typeof
|
|
35
|
+
if (typeof extract[2] === 'string') {
|
|
36
36
|
error.push(stylize((ctx.line + 1) + ' ' + extract[2], 'grey'));
|
|
37
37
|
}
|
|
38
38
|
error = error.join('\n') + stylize('', 'reset') + '\n';
|
|
39
39
|
|
|
40
40
|
message += stylize(ctx.type + 'Error: ' + ctx.message, 'red');
|
|
41
41
|
if (ctx.filename) {
|
|
42
|
-
|
|
42
|
+
message += stylize(' in ', 'red') + ctx.filename +
|
|
43
43
|
stylize(' on line ' + ctx.line + ', column ' + (ctx.column + 1) + ':', 'grey');
|
|
44
44
|
}
|
|
45
45
|
|
|
@@ -113,7 +113,7 @@ less.Parser.fileLoader = function (file, currentFileInfo, callback, env) {
|
|
|
113
113
|
}
|
|
114
114
|
|
|
115
115
|
var j = file.lastIndexOf('/');
|
|
116
|
-
if(newFileInfo.relativeUrls && !/^(?:[a-z-]+:|\/)/.test(file) && j != -1) {
|
|
116
|
+
if (newFileInfo.relativeUrls && !/^(?:[a-z-]+:|\/)/.test(file) && j != -1) {
|
|
117
117
|
var relativeSubDirectory = file.slice(0, j + 1);
|
|
118
118
|
newFileInfo.rootpath = newFileInfo.rootpath + relativeSubDirectory; // append (sub|sup) directory path of imported file
|
|
119
119
|
}
|
|
@@ -196,8 +196,12 @@ function writeFile(filename, content) {
|
|
|
196
196
|
}
|
|
197
197
|
|
|
198
198
|
match = arg.match(/^--?([a-z][0-9a-z-]*)(?:=(.*))?$/i);
|
|
199
|
-
if (match) {
|
|
200
|
-
|
|
199
|
+
if (match) {
|
|
200
|
+
arg = match[1];
|
|
201
|
+
}
|
|
202
|
+
else {
|
|
203
|
+
return arg;
|
|
204
|
+
}
|
|
201
205
|
|
|
202
206
|
switch (arg) {
|
|
203
207
|
case 'v':
|
|
@@ -305,10 +309,10 @@ function writeFile(filename, content) {
|
|
|
305
309
|
case 'source-map-output-map-file':
|
|
306
310
|
if (checkArgFunc(arg, match[2])) {
|
|
307
311
|
options.writeSourceMap = function(sourceMapContent) {
|
|
308
|
-
|
|
312
|
+
writeFile(match[2], sourceMapContent);
|
|
309
313
|
};
|
|
310
314
|
}
|
|
311
|
-
|
|
315
|
+
break;
|
|
312
316
|
case 'rp':
|
|
313
317
|
case 'rootpath':
|
|
314
318
|
if (checkArgFunc(arg, match[2])) {
|
|
@@ -1872,7 +1872,7 @@ define('source-map/source-node', ['require', 'exports', 'module' , 'source-map/
|
|
|
1872
1872
|
if (original.source !== null
|
|
1873
1873
|
&& original.line !== null
|
|
1874
1874
|
&& original.column !== null) {
|
|
1875
|
-
if(lastOriginalSource !== original.source
|
|
1875
|
+
if (lastOriginalSource !== original.source
|
|
1876
1876
|
|| lastOriginalLine !== original.line
|
|
1877
1877
|
|| lastOriginalColumn !== original.column
|
|
1878
1878
|
|| lastOriginalName !== original.name) {
|
package/package.json
CHANGED
|
@@ -18,34 +18,34 @@ if (window.navigator.userAgent.indexOf("MSIE") >= 0) {
|
|
|
18
18
|
// setup style tags with less and link tags pointing to expected css output
|
|
19
19
|
|
|
20
20
|
for (var i = 0; i < testFiles.length; i++) {
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
21
|
+
var file = testFiles[i],
|
|
22
|
+
lessPath = '/test/less/' + file + '.less',
|
|
23
|
+
cssPath = '/test/css/' + file + '.css',
|
|
24
|
+
lessStyle = document.createElement('style'),
|
|
25
|
+
cssLink = document.createElement('link'),
|
|
26
|
+
lessText = '@import "' + lessPath + '";';
|
|
27
27
|
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
28
|
+
lessStyle.type = 'text/less';
|
|
29
|
+
lessStyle.id = file;
|
|
30
|
+
lessStyle.href = file;
|
|
31
31
|
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
32
|
+
if (lessStyle.styleSheet === undefined) {
|
|
33
|
+
lessStyle.appendChild(document.createTextNode(lessText));
|
|
34
|
+
}
|
|
35
35
|
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
36
|
+
cssLink.rel = 'stylesheet';
|
|
37
|
+
cssLink.type = 'text/css';
|
|
38
|
+
cssLink.href = cssPath;
|
|
39
|
+
cssLink.id = 'expected-' + file;
|
|
40
40
|
|
|
41
|
-
|
|
41
|
+
var head = document.getElementsByTagName('head')[0];
|
|
42
42
|
|
|
43
|
-
|
|
43
|
+
head.appendChild(lessStyle);
|
|
44
44
|
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
45
|
+
if (lessStyle.styleSheet) {
|
|
46
|
+
lessStyle.styleSheet.cssText = lessText;
|
|
47
|
+
}
|
|
48
48
|
|
|
49
|
-
|
|
50
|
-
|
|
49
|
+
head.appendChild(cssLink);
|
|
50
|
+
testSheets[i] = lessStyle;
|
|
51
51
|
}
|
|
@@ -5,14 +5,14 @@ var less = {
|
|
|
5
5
|
less.strictMath = true;
|
|
6
6
|
less.functions = {
|
|
7
7
|
add: function(a, b) {
|
|
8
|
-
|
|
8
|
+
return new(less.tree.Dimension)(a.value + b.value);
|
|
9
9
|
},
|
|
10
10
|
increment: function(a) {
|
|
11
|
-
|
|
11
|
+
return new(less.tree.Dimension)(a.value + 1);
|
|
12
12
|
},
|
|
13
13
|
_color: function(str) {
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
14
|
+
if (str.value === "evil red") {
|
|
15
|
+
return new(less.tree.Color)("600");
|
|
16
|
+
}
|
|
17
17
|
}
|
|
18
18
|
};
|
package/test/copy-bom.js
CHANGED
|
@@ -11,34 +11,34 @@ module.exports = function() {
|
|
|
11
11
|
var _buff = new Buffer(BUF_LENGTH);
|
|
12
12
|
|
|
13
13
|
function copyFolderWithBom(src, dest) {
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
14
|
+
var stats = fs.lstatSync(src);
|
|
15
|
+
var destFolder = path.dirname(dest);
|
|
16
|
+
var destFolderExists = fs.existsSync(destFolder);
|
|
17
|
+
var performCopy = false;
|
|
18
18
|
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
}
|
|
29
|
-
else if (stats.isDirectory()) {
|
|
30
|
-
if (!fs.existsSync(destFolder)) {
|
|
31
|
-
fs.mkdirSync(destFolder);
|
|
32
|
-
}
|
|
33
|
-
if (!fs.existsSync(dest)) {
|
|
34
|
-
fs.mkdirSync(dest);
|
|
19
|
+
if (stats.isFile()) {
|
|
20
|
+
if (!destFolderExists) {
|
|
21
|
+
fs.mkdirSync(destFolder);
|
|
22
|
+
}
|
|
23
|
+
if (src.match(/\.(css|less)$/)) {
|
|
24
|
+
copyFileAddingBomSync(src, dest);
|
|
25
|
+
} else {
|
|
26
|
+
copyFileSync(src, dest);
|
|
27
|
+
}
|
|
35
28
|
}
|
|
36
|
-
|
|
37
|
-
if (
|
|
38
|
-
|
|
29
|
+
else if (stats.isDirectory()) {
|
|
30
|
+
if (!fs.existsSync(destFolder)) {
|
|
31
|
+
fs.mkdirSync(destFolder);
|
|
32
|
+
}
|
|
33
|
+
if (!fs.existsSync(dest)) {
|
|
34
|
+
fs.mkdirSync(dest);
|
|
39
35
|
}
|
|
40
|
-
|
|
41
|
-
|
|
36
|
+
fs.readdirSync(src).forEach(function(d) {
|
|
37
|
+
if (d !== 'bom') {
|
|
38
|
+
copyFolderWithBom(path.join(src, d), path.join(dest, d));
|
|
39
|
+
}
|
|
40
|
+
});
|
|
41
|
+
}
|
|
42
42
|
}
|
|
43
43
|
|
|
44
44
|
function copyFileAddingBomSync(srcFile, destFile) {
|
|
@@ -50,20 +50,20 @@ module.exports = function() {
|
|
|
50
50
|
}
|
|
51
51
|
|
|
52
52
|
function copyFileSync(srcFile, destFile) {
|
|
53
|
-
var fdr = fs.openSync(srcFile, 'r')
|
|
54
|
-
var stat = fs.fstatSync(fdr)
|
|
55
|
-
var fdw = fs.openSync(destFile, 'w', stat.mode)
|
|
56
|
-
var bytesRead = 1
|
|
57
|
-
var pos = 0
|
|
53
|
+
var fdr = fs.openSync(srcFile, 'r');
|
|
54
|
+
var stat = fs.fstatSync(fdr);
|
|
55
|
+
var fdw = fs.openSync(destFile, 'w', stat.mode);
|
|
56
|
+
var bytesRead = 1;
|
|
57
|
+
var pos = 0;
|
|
58
58
|
|
|
59
59
|
while (bytesRead > 0) {
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
60
|
+
bytesRead = fs.readSync(fdr, _buff, 0, BUF_LENGTH, pos)
|
|
61
|
+
fs.writeSync(fdw, _buff, 0, bytesRead);
|
|
62
|
+
pos += bytesRead;
|
|
63
63
|
}
|
|
64
64
|
|
|
65
|
-
fs.closeSync(fdr)
|
|
66
|
-
fs.closeSync(fdw)
|
|
65
|
+
fs.closeSync(fdr);
|
|
66
|
+
fs.closeSync(fdw);
|
|
67
67
|
}
|
|
68
68
|
|
|
69
69
|
return {
|
package/test/css/functions.css
CHANGED
package/test/css/selectors.css
CHANGED
|
@@ -163,3 +163,8 @@ blank blank blank blank blank blank blank blank blank blank blank blank blank bl
|
|
|
163
163
|
.selector:not(:hover) {
|
|
164
164
|
test: global scope;
|
|
165
165
|
}
|
|
166
|
+
.extend-this,
|
|
167
|
+
.active.first-level .second-level,
|
|
168
|
+
.first-level .second-level.active2 {
|
|
169
|
+
content: '\2661';
|
|
170
|
+
}
|
package/test/css/urls.css
CHANGED
package/test/index.js
CHANGED
|
@@ -40,6 +40,7 @@ lessTester.runTestSet({strictMath: true, strictUnits: true, sourceMap: true, glo
|
|
|
40
40
|
}
|
|
41
41
|
return path.join('test/sourcemaps', filename) + '.json';
|
|
42
42
|
});
|
|
43
|
+
lessTester.runTestSet({strictMath: true, strictUnits: true, sourceMap: {sourceMapFileInline: true}}, "sourcemaps-empty/", lessTester.testEmptySourcemap);
|
|
43
44
|
lessTester.runTestSet({globalVars: true, banner: "/**\n * Test\n */\n"}, "globalVars/",
|
|
44
45
|
null, null, null, function(name, type, baseFolder) { return path.join(baseFolder, name) + '.json'; });
|
|
45
46
|
lessTester.runTestSet({modifyVars: true}, "modifyVars/",
|
|
@@ -49,4 +50,4 @@ lessTester.runTestSet({paths: ['test/data/', 'test/less/import/']}, "include-pat
|
|
|
49
50
|
lessTester.testSyncronous({syncImport: true}, "import");
|
|
50
51
|
lessTester.testSyncronous({syncImport: true}, "css");
|
|
51
52
|
lessTester.testNoOptions();
|
|
52
|
-
lessTester.finished();
|
|
53
|
+
lessTester.finished();
|
package/test/less/functions.less
CHANGED
|
@@ -199,3 +199,16 @@
|
|
|
199
199
|
}
|
|
200
200
|
}
|
|
201
201
|
|
|
202
|
+
#list-details {
|
|
203
|
+
@list:
|
|
204
|
+
a 1, // Some comment
|
|
205
|
+
b 2;
|
|
206
|
+
|
|
207
|
+
length: length(@list);
|
|
208
|
+
one: extract(@list, 1);
|
|
209
|
+
@two: extract(@list, 2);
|
|
210
|
+
two: @two;
|
|
211
|
+
two-length: length(@two);
|
|
212
|
+
two-one: extract(@two, 1);
|
|
213
|
+
two-two: extract(@two, 2);
|
|
214
|
+
}
|
|
@@ -34,4 +34,20 @@
|
|
|
34
34
|
}
|
|
35
35
|
.when-calling-nested-with-param-issue-2394 {
|
|
36
36
|
.size(10px) !important;
|
|
37
|
-
}
|
|
37
|
+
}
|
|
38
|
+
.testMixin-2421 () {
|
|
39
|
+
.topCheck-2421 () {
|
|
40
|
+
.nestedCheck-2421() {
|
|
41
|
+
margin: 5px;
|
|
42
|
+
}
|
|
43
|
+
.nestedCheck-2421();
|
|
44
|
+
}
|
|
45
|
+
.topCheck-2421();
|
|
46
|
+
}
|
|
47
|
+
.class1-2421 {
|
|
48
|
+
.testMixin-2421() !important;
|
|
49
|
+
}
|
|
50
|
+
.class2-2421 {
|
|
51
|
+
.testMixin-2421();
|
|
52
|
+
}
|
|
53
|
+
|
package/test/less/selectors.less
CHANGED
|
@@ -172,3 +172,13 @@ blank blank blank blank blank blank blank blank blank blank blank blank blank bl
|
|
|
172
172
|
.selector:not(&:hover) {
|
|
173
173
|
test: global scope;
|
|
174
174
|
}
|
|
175
|
+
// https://github.com/less/less.js/issues/2206
|
|
176
|
+
.extend-this {
|
|
177
|
+
content: '\2661';
|
|
178
|
+
}
|
|
179
|
+
.first-level {
|
|
180
|
+
.second-level {
|
|
181
|
+
.active&:extend(.extend-this) { }
|
|
182
|
+
&.active2:extend(.extend-this) { }
|
|
183
|
+
}
|
|
184
|
+
}
|
|
File without changes
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
@test-var: 'something';
|
package/test/less/urls.less
CHANGED
|
@@ -47,7 +47,7 @@
|
|
|
47
47
|
uri: data-uri('image/jpeg;base64', '../data/image.jpg');
|
|
48
48
|
@var: replace('../data/replace.jpg', "replace", "image");
|
|
49
49
|
background-image: data-uri(@var), data-uri(replace('../data/image.filext', "filext", "jpg"));
|
|
50
|
-
|
|
50
|
+
|
|
51
51
|
uri-fragment: data-uri('image/jpeg;base64', '../data/image.jpg#fragment');
|
|
52
52
|
}
|
|
53
53
|
|
package/test/less-test.js
CHANGED
|
@@ -2,8 +2,9 @@
|
|
|
2
2
|
|
|
3
3
|
module.exports = function() {
|
|
4
4
|
var path = require('path'),
|
|
5
|
-
fs = require('fs')
|
|
6
|
-
copyBom = require('./copy-bom')()
|
|
5
|
+
fs = require('fs'),
|
|
6
|
+
copyBom = require('./copy-bom')(),
|
|
7
|
+
doBomTest = false;
|
|
7
8
|
|
|
8
9
|
var less = require('../lib/less-node');
|
|
9
10
|
var stylize = require('../lib/less-node/lessc-helper').stylize;
|
|
@@ -88,6 +89,23 @@ module.exports = function() {
|
|
|
88
89
|
});
|
|
89
90
|
}
|
|
90
91
|
|
|
92
|
+
function testEmptySourcemap(name, err, compiledLess, doReplacements, sourcemap, baseFolder) {
|
|
93
|
+
process.stdout.write("- " + path.join(baseFolder, name) + ": ");
|
|
94
|
+
if (err) {
|
|
95
|
+
fail("ERROR: " + (err && err.message));
|
|
96
|
+
} else {
|
|
97
|
+
var expectedSourcemap = undefined;
|
|
98
|
+
if ( compiledLess !== "" ) {
|
|
99
|
+
difference("\nCompiledLess must be empty", "", compiledLess);
|
|
100
|
+
|
|
101
|
+
} else if (sourcemap !== expectedSourcemap) {
|
|
102
|
+
fail("Sourcemap must be undefined");
|
|
103
|
+
} else {
|
|
104
|
+
ok('OK');
|
|
105
|
+
}
|
|
106
|
+
}
|
|
107
|
+
}
|
|
108
|
+
|
|
91
109
|
function testErrors(name, err, compiledLess, doReplacements, sourcemap, baseFolder) {
|
|
92
110
|
fs.readFile(path.join(baseFolder, name) + '.txt', 'utf8', function (e, expectedErr) {
|
|
93
111
|
process.stdout.write("- " + path.join(baseFolder, name) + ": ");
|
|
@@ -134,29 +152,32 @@ module.exports = function() {
|
|
|
134
152
|
}
|
|
135
153
|
totalTests++;
|
|
136
154
|
queue(function() {
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
155
|
+
var isSync = true;
|
|
156
|
+
toCSS(options, path.join(normalFolder, filenameNoExtension + ".less"), function (err, result) {
|
|
157
|
+
process.stdout.write("- Test Sync " + filenameNoExtension + ": ");
|
|
140
158
|
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
159
|
+
if (isSync) {
|
|
160
|
+
ok("OK");
|
|
161
|
+
} else {
|
|
162
|
+
fail("Not Sync");
|
|
163
|
+
}
|
|
164
|
+
release();
|
|
165
|
+
});
|
|
166
|
+
isSync = false;
|
|
149
167
|
});
|
|
150
168
|
}
|
|
151
169
|
|
|
152
170
|
function prepBomTest() {
|
|
153
|
-
|
|
171
|
+
copyBom.copyFolderWithBom(normalFolder, bomFolder);
|
|
172
|
+
doBomTest = true;
|
|
154
173
|
}
|
|
155
174
|
|
|
156
175
|
function runTestSet(options, foldername, verifyFunction, nameModifier, doReplacements, getFilename) {
|
|
157
176
|
var options2 = options ? JSON.parse(JSON.stringify(options)) : {};
|
|
158
177
|
runTestSetInternal(normalFolder, options, foldername, verifyFunction, nameModifier, doReplacements, getFilename);
|
|
159
|
-
|
|
178
|
+
if (doBomTest) {
|
|
179
|
+
runTestSetInternal(bomFolder, options2, foldername, verifyFunction, nameModifier, doReplacements, getFilename);
|
|
180
|
+
}
|
|
160
181
|
}
|
|
161
182
|
|
|
162
183
|
function runTestSetNormalOnly(options, foldername, verifyFunction, nameModifier, doReplacements, getFilename) {
|
|
@@ -166,12 +187,12 @@ module.exports = function() {
|
|
|
166
187
|
function runTestSetInternal(baseFolder, options, foldername, verifyFunction, nameModifier, doReplacements, getFilename) {
|
|
167
188
|
foldername = foldername || "";
|
|
168
189
|
|
|
169
|
-
if(!doReplacements) {
|
|
190
|
+
if (!doReplacements) {
|
|
170
191
|
doReplacements = globalReplacements;
|
|
171
192
|
}
|
|
172
193
|
|
|
173
194
|
function getBasename(file) {
|
|
174
|
-
|
|
195
|
+
return foldername + path.basename(file, '.less');
|
|
175
196
|
}
|
|
176
197
|
|
|
177
198
|
fs.readdirSync(path.join(baseFolder, foldername)).forEach(function (file) {
|
|
@@ -185,7 +206,7 @@ module.exports = function() {
|
|
|
185
206
|
|
|
186
207
|
totalTests++;
|
|
187
208
|
|
|
188
|
-
if (options.sourceMap) {
|
|
209
|
+
if (options.sourceMap && !options.sourceMap.sourceMapFileInline) {
|
|
189
210
|
options.sourceMapOutputFilename = name + ".css";
|
|
190
211
|
options.sourceMapBasepath = path.join(process.cwd(), baseFolder);
|
|
191
212
|
options.sourceMapRootpath = "testweb/";
|
|
@@ -224,11 +245,11 @@ module.exports = function() {
|
|
|
224
245
|
return;
|
|
225
246
|
}
|
|
226
247
|
var css_name = name;
|
|
227
|
-
if(nameModifier) { css_name = nameModifier(name); }
|
|
248
|
+
if (nameModifier) { css_name = nameModifier(name); }
|
|
228
249
|
fs.readFile(path.join('test/css', css_name) + '.css', 'utf8', function (e, css) {
|
|
229
250
|
process.stdout.write("- " + path.join(baseFolder, css_name) + ": ");
|
|
230
251
|
|
|
231
|
-
|
|
252
|
+
css = css && doReplacements(css, path.join(baseFolder, foldername));
|
|
232
253
|
if (result.css === css) { ok('OK'); }
|
|
233
254
|
else {
|
|
234
255
|
difference("FAIL", css, result.css);
|
|
@@ -242,12 +263,12 @@ module.exports = function() {
|
|
|
242
263
|
|
|
243
264
|
function diff(left, right) {
|
|
244
265
|
require('diff').diffLines(left, right).forEach(function(item) {
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
266
|
+
if (item.added || item.removed) {
|
|
267
|
+
var text = item.value && item.value.replace("\n", String.fromCharCode(182) + "\n").replace('\ufeff', '[[BOM]]');
|
|
268
|
+
process.stdout.write(stylize(text, item.added ? 'green' : 'red'));
|
|
269
|
+
} else {
|
|
270
|
+
process.stdout.write(item.value && item.value.replace('\ufeff', '[[BOM]]'));
|
|
271
|
+
}
|
|
251
272
|
});
|
|
252
273
|
process.stdout.write("\n");
|
|
253
274
|
}
|
|
@@ -313,7 +334,7 @@ module.exports = function() {
|
|
|
313
334
|
|
|
314
335
|
options.paths = options.paths || [];
|
|
315
336
|
if (!contains(options.paths, addPath)) {
|
|
316
|
-
|
|
337
|
+
options.paths.push(addPath);
|
|
317
338
|
}
|
|
318
339
|
options.filename = require('path').resolve(process.cwd(), path);
|
|
319
340
|
options.optimization = options.optimization || 0;
|
|
@@ -348,6 +369,7 @@ module.exports = function() {
|
|
|
348
369
|
testSyncronous: testSyncronous,
|
|
349
370
|
testErrors: testErrors,
|
|
350
371
|
testSourcemap: testSourcemap,
|
|
372
|
+
testEmptySourcemap: testEmptySourcemap,
|
|
351
373
|
testNoOptions: testNoOptions,
|
|
352
374
|
prepBomTest: prepBomTest,
|
|
353
375
|
finished: finished
|
package/test/modify-vars.js
CHANGED
|
@@ -1,19 +1,19 @@
|
|
|
1
1
|
var less = require('../lib/less'),
|
|
2
|
-
fs = require('fs')
|
|
2
|
+
fs = require('fs');
|
|
3
3
|
|
|
4
|
-
var input = fs.readFileSync("./test/less/modifyVars/extended.less", 'utf8')
|
|
5
|
-
var expectedCss = fs.readFileSync('./test/css/modifyVars/extended.css', 'utf8')
|
|
4
|
+
var input = fs.readFileSync("./test/less/modifyVars/extended.less", 'utf8');
|
|
5
|
+
var expectedCss = fs.readFileSync('./test/css/modifyVars/extended.css', 'utf8');
|
|
6
6
|
var options = {
|
|
7
|
-
|
|
8
|
-
}
|
|
7
|
+
modifyVars: JSON.parse(fs.readFileSync("./test/less/modifyVars/extended.json", 'utf8'))
|
|
8
|
+
};
|
|
9
9
|
|
|
10
10
|
less.render(input, options, function (err, result) {
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
11
|
+
if (err) {
|
|
12
|
+
console.log(err);
|
|
13
|
+
}
|
|
14
|
+
if (result.css === expectedCss) {
|
|
15
|
+
console.log("PASS");
|
|
16
|
+
} else {
|
|
17
|
+
console.log("FAIL");
|
|
18
|
+
}
|
|
19
19
|
});
|