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
|
@@ -31,7 +31,7 @@ ExtendFinderVisitor.prototype = {
|
|
|
31
31
|
|
|
32
32
|
// get &:extend(.a); rules which apply to all selectors in this ruleset
|
|
33
33
|
var rules = rulesetNode.rules, ruleCnt = rules ? rules.length : 0;
|
|
34
|
-
for(i = 0; i < ruleCnt; i++) {
|
|
34
|
+
for (i = 0; i < ruleCnt; i++) {
|
|
35
35
|
if (rulesetNode.rules[i] instanceof tree.Extend) {
|
|
36
36
|
allSelectorsExtendList.push(rules[i]);
|
|
37
37
|
rulesetNode.extendOnEveryPath = true;
|
|
@@ -41,7 +41,7 @@ ExtendFinderVisitor.prototype = {
|
|
|
41
41
|
// now find every selector and apply the extends that apply to all extends
|
|
42
42
|
// and the ones which apply to an individual extend
|
|
43
43
|
var paths = rulesetNode.paths;
|
|
44
|
-
for(i = 0; i < paths.length; i++) {
|
|
44
|
+
for (i = 0; i < paths.length; i++) {
|
|
45
45
|
var selectorPath = paths[i],
|
|
46
46
|
selector = selectorPath[selectorPath.length - 1],
|
|
47
47
|
selExtendList = selector.extendList;
|
|
@@ -55,7 +55,7 @@ ExtendFinderVisitor.prototype = {
|
|
|
55
55
|
});
|
|
56
56
|
}
|
|
57
57
|
|
|
58
|
-
for(j = 0; j < extendList.length; j++) {
|
|
58
|
+
for (j = 0; j < extendList.length; j++) {
|
|
59
59
|
this.foundExtends = true;
|
|
60
60
|
extend = extendList[j];
|
|
61
61
|
extend.findSelfSelectors(selectorPath);
|
|
@@ -112,9 +112,10 @@ ProcessExtendsVisitor.prototype = {
|
|
|
112
112
|
var selector = "_unknown_";
|
|
113
113
|
try {
|
|
114
114
|
selector = extend.selector.toCSS({});
|
|
115
|
-
}
|
|
115
|
+
}
|
|
116
|
+
catch(_) {}
|
|
116
117
|
|
|
117
|
-
if(!indicies[extend.index + ' ' + selector]) {
|
|
118
|
+
if (!indicies[extend.index + ' ' + selector]) {
|
|
118
119
|
indicies[extend.index + ' ' + selector] = true;
|
|
119
120
|
logger.warn("extend '" + selector + "' has no matches");
|
|
120
121
|
}
|
|
@@ -141,14 +142,14 @@ ProcessExtendsVisitor.prototype = {
|
|
|
141
142
|
// and the second is the target.
|
|
142
143
|
// the seperation into two lists allows us to process a subset of chains with a bigger set, as is the
|
|
143
144
|
// case when processing media queries
|
|
144
|
-
for(extendIndex = 0; extendIndex < extendsList.length; extendIndex++){
|
|
145
|
-
for(targetExtendIndex = 0; targetExtendIndex < extendsListTarget.length; targetExtendIndex++){
|
|
145
|
+
for (extendIndex = 0; extendIndex < extendsList.length; extendIndex++) {
|
|
146
|
+
for (targetExtendIndex = 0; targetExtendIndex < extendsListTarget.length; targetExtendIndex++) {
|
|
146
147
|
|
|
147
148
|
extend = extendsList[extendIndex];
|
|
148
149
|
targetExtend = extendsListTarget[targetExtendIndex];
|
|
149
150
|
|
|
150
151
|
// look for circular references
|
|
151
|
-
if( extend.parent_ids.indexOf( targetExtend.object_id ) >= 0 ){ continue; }
|
|
152
|
+
if ( extend.parent_ids.indexOf( targetExtend.object_id ) >= 0 ) { continue; }
|
|
152
153
|
|
|
153
154
|
// find a match in the target extends self selector (the bit before :extend)
|
|
154
155
|
selectorPath = [targetExtend.selfSelectors[0]];
|
|
@@ -232,8 +233,8 @@ ProcessExtendsVisitor.prototype = {
|
|
|
232
233
|
|
|
233
234
|
// look at each selector path in the ruleset, find any extend matches and then copy, find and replace
|
|
234
235
|
|
|
235
|
-
for(extendIndex = 0; extendIndex < allExtends.length; extendIndex++) {
|
|
236
|
-
for(pathIndex = 0; pathIndex < rulesetNode.paths.length; pathIndex++) {
|
|
236
|
+
for (extendIndex = 0; extendIndex < allExtends.length; extendIndex++) {
|
|
237
|
+
for (pathIndex = 0; pathIndex < rulesetNode.paths.length; pathIndex++) {
|
|
237
238
|
selectorPath = rulesetNode.paths[pathIndex];
|
|
238
239
|
|
|
239
240
|
// extending extends happens initially, before the main pass
|
|
@@ -266,10 +267,10 @@ ProcessExtendsVisitor.prototype = {
|
|
|
266
267
|
potentialMatches = [], potentialMatch, matches = [];
|
|
267
268
|
|
|
268
269
|
// loop through the haystack elements
|
|
269
|
-
for(haystackSelectorIndex = 0; haystackSelectorIndex < haystackSelectorPath.length; haystackSelectorIndex++) {
|
|
270
|
+
for (haystackSelectorIndex = 0; haystackSelectorIndex < haystackSelectorPath.length; haystackSelectorIndex++) {
|
|
270
271
|
hackstackSelector = haystackSelectorPath[haystackSelectorIndex];
|
|
271
272
|
|
|
272
|
-
for(hackstackElementIndex = 0; hackstackElementIndex < hackstackSelector.elements.length; hackstackElementIndex++) {
|
|
273
|
+
for (hackstackElementIndex = 0; hackstackElementIndex < hackstackSelector.elements.length; hackstackElementIndex++) {
|
|
273
274
|
|
|
274
275
|
haystackElement = hackstackSelector.elements[hackstackElementIndex];
|
|
275
276
|
|
|
@@ -279,7 +280,7 @@ ProcessExtendsVisitor.prototype = {
|
|
|
279
280
|
initialCombinator: haystackElement.combinator});
|
|
280
281
|
}
|
|
281
282
|
|
|
282
|
-
for(i = 0; i < potentialMatches.length; i++) {
|
|
283
|
+
for (i = 0; i < potentialMatches.length; i++) {
|
|
283
284
|
potentialMatch = potentialMatches[i];
|
|
284
285
|
|
|
285
286
|
// selectors add " " onto the first element. When we use & it joins the selectors together, but if we don't
|
|
@@ -349,7 +350,7 @@ ProcessExtendsVisitor.prototype = {
|
|
|
349
350
|
if (!(elementValue2 instanceof tree.Selector) || elementValue1.elements.length !== elementValue2.elements.length) {
|
|
350
351
|
return false;
|
|
351
352
|
}
|
|
352
|
-
for(var i = 0; i < elementValue1.elements.length; i++) {
|
|
353
|
+
for (var i = 0; i < elementValue1.elements.length; i++) {
|
|
353
354
|
if (elementValue1.elements[i].combinator.value !== elementValue2.elements[i].combinator.value) {
|
|
354
355
|
if (i !== 0 || (elementValue1.elements[i].combinator.value || ' ') !== (elementValue2.elements[i].combinator.value || ' ')) {
|
|
355
356
|
return false;
|
|
@@ -27,8 +27,8 @@ ImportSequencer.prototype.addVariableImport = function(callback) {
|
|
|
27
27
|
ImportSequencer.prototype.tryRun = function() {
|
|
28
28
|
this._currentDepth++;
|
|
29
29
|
try {
|
|
30
|
-
while(true) {
|
|
31
|
-
while(this.imports.length > 0) {
|
|
30
|
+
while (true) {
|
|
31
|
+
while (this.imports.length > 0) {
|
|
32
32
|
var importItem = this.imports[0];
|
|
33
33
|
if (!importItem.isReady) {
|
|
34
34
|
return;
|
|
@@ -57,7 +57,7 @@ ImportVisitor.prototype = {
|
|
|
57
57
|
|
|
58
58
|
try {
|
|
59
59
|
evaldImportNode = importNode.evalForImport(context);
|
|
60
|
-
} catch(e){
|
|
60
|
+
} catch(e) {
|
|
61
61
|
if (!e.filename) { e.index = importNode.index; e.filename = importNode.currentFileInfo.filename; }
|
|
62
62
|
// attempt to eval properly and treat as css
|
|
63
63
|
importNode.css = true;
|
|
@@ -74,7 +74,7 @@ ImportVisitor.prototype = {
|
|
|
74
74
|
// try appending if we haven't determined if it is css or not
|
|
75
75
|
var tryAppendLessExtension = evaldImportNode.css === undefined;
|
|
76
76
|
|
|
77
|
-
for(var i = 0; i < importParent.rules.length; i++) {
|
|
77
|
+
for (var i = 0; i < importParent.rules.length; i++) {
|
|
78
78
|
if (importParent.rules[i] === importNode) {
|
|
79
79
|
importParent.rules[i] = evaldImportNode;
|
|
80
80
|
break;
|
|
@@ -103,7 +103,7 @@ ToCSSVisitor.prototype = {
|
|
|
103
103
|
|
|
104
104
|
checkPropertiesInRoot: function(rules) {
|
|
105
105
|
var ruleNode;
|
|
106
|
-
for(var i = 0; i < rules.length; i++) {
|
|
106
|
+
for (var i = 0; i < rules.length; i++) {
|
|
107
107
|
ruleNode = rules[i];
|
|
108
108
|
if (ruleNode instanceof tree.Rule && !ruleNode.variable) {
|
|
109
109
|
throw { message: "properties must be inside selector blocks, they cannot be in the root.",
|
|
@@ -125,7 +125,7 @@ ToCSSVisitor.prototype = {
|
|
|
125
125
|
if (p[0].elements[0].combinator.value === ' ') {
|
|
126
126
|
p[0].elements[0].combinator = new(tree.Combinator)('');
|
|
127
127
|
}
|
|
128
|
-
for(i = 0; i < p.length; i++) {
|
|
128
|
+
for (i = 0; i < p.length; i++) {
|
|
129
129
|
if (p[i].getIsReferenced() && p[i].getIsOutput()) {
|
|
130
130
|
return true;
|
|
131
131
|
}
|
|
@@ -190,7 +190,7 @@ ToCSSVisitor.prototype = {
|
|
|
190
190
|
var ruleCache = {},
|
|
191
191
|
ruleList, rule, i;
|
|
192
192
|
|
|
193
|
-
for(i = rules.length - 1; i >= 0 ; i--) {
|
|
193
|
+
for (i = rules.length - 1; i >= 0 ; i--) {
|
|
194
194
|
rule = rules[i];
|
|
195
195
|
if (rule instanceof tree.Rule) {
|
|
196
196
|
if (!ruleCache[rule.name]) {
|
|
@@ -257,8 +257,8 @@ ToCSSVisitor.prototype = {
|
|
|
257
257
|
var spacedGroups = [];
|
|
258
258
|
var lastSpacedGroup = [];
|
|
259
259
|
parts.map(function (p) {
|
|
260
|
-
|
|
261
|
-
|
|
260
|
+
if (p.merge === "+") {
|
|
261
|
+
if (lastSpacedGroup.length > 0) {
|
|
262
262
|
spacedGroups.push(toExpression(lastSpacedGroup));
|
|
263
263
|
}
|
|
264
264
|
lastSpacedGroup = [];
|
|
@@ -4,13 +4,13 @@ module.exports = function(window, options, logger) {
|
|
|
4
4
|
var cache = null;
|
|
5
5
|
if (options.env !== 'development') {
|
|
6
6
|
try {
|
|
7
|
-
cache = (typeof
|
|
7
|
+
cache = (typeof window.localStorage === 'undefined') ? null : window.localStorage;
|
|
8
8
|
} catch (_) {}
|
|
9
9
|
}
|
|
10
10
|
return {
|
|
11
11
|
setCSS: function(path, lastModified, styles) {
|
|
12
12
|
if (cache) {
|
|
13
|
-
logger.info('saving ' + path+ ' to cache.');
|
|
13
|
+
logger.info('saving ' + path + ' to cache.');
|
|
14
14
|
try {
|
|
15
15
|
cache.setItem(path, styles);
|
|
16
16
|
cache.setItem(path + ':timestamp', lastModified);
|
|
@@ -2,118 +2,118 @@
|
|
|
2
2
|
|
|
3
3
|
module.exports = function(options, logger) {
|
|
4
4
|
|
|
5
|
-
var AbstractFileManager = require("../less/environment/abstract-file-manager.js");
|
|
6
|
-
|
|
7
|
-
var fileCache = {};
|
|
8
|
-
|
|
9
|
-
//TODOS - move log somewhere. pathDiff and doing something similar in node. use pathDiff in the other browser file for the initial load
|
|
10
|
-
|
|
11
|
-
function getXMLHttpRequest() {
|
|
12
|
-
if (window.XMLHttpRequest && (window.location.protocol !== "file:" || !("ActiveXObject" in window))) {
|
|
13
|
-
return new XMLHttpRequest();
|
|
14
|
-
} else {
|
|
15
|
-
try {
|
|
16
|
-
/*global ActiveXObject */
|
|
17
|
-
return new ActiveXObject("Microsoft.XMLHTTP");
|
|
18
|
-
} catch (e) {
|
|
19
|
-
logger.error("browser doesn't support AJAX.");
|
|
20
|
-
return null;
|
|
21
|
-
}
|
|
22
|
-
}
|
|
23
|
-
}
|
|
5
|
+
var AbstractFileManager = require("../less/environment/abstract-file-manager.js");
|
|
24
6
|
|
|
25
|
-
var
|
|
26
|
-
};
|
|
7
|
+
var fileCache = {};
|
|
27
8
|
|
|
28
|
-
|
|
9
|
+
//TODOS - move log somewhere. pathDiff and doing something similar in node. use pathDiff in the other browser file for the initial load
|
|
29
10
|
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
11
|
+
function getXMLHttpRequest() {
|
|
12
|
+
if (window.XMLHttpRequest && (window.location.protocol !== "file:" || !("ActiveXObject" in window))) {
|
|
13
|
+
return new XMLHttpRequest();
|
|
14
|
+
} else {
|
|
15
|
+
try {
|
|
16
|
+
/*global ActiveXObject */
|
|
17
|
+
return new ActiveXObject("Microsoft.XMLHTTP");
|
|
18
|
+
} catch (e) {
|
|
19
|
+
logger.error("browser doesn't support AJAX.");
|
|
20
|
+
return null;
|
|
21
|
+
}
|
|
22
|
+
}
|
|
36
23
|
}
|
|
37
|
-
return this.extractUrlParts(laterPath, basePath).path;
|
|
38
|
-
};
|
|
39
|
-
FileManager.prototype.doXHR = function doXHR(url, type, callback, errback) {
|
|
40
24
|
|
|
41
|
-
var
|
|
42
|
-
|
|
25
|
+
var FileManager = function() {
|
|
26
|
+
};
|
|
43
27
|
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
function handleResponse(xhr, callback, errback) {
|
|
53
|
-
if (xhr.status >= 200 && xhr.status < 300) {
|
|
54
|
-
callback(xhr.responseText,
|
|
55
|
-
xhr.getResponseHeader("Last-Modified"));
|
|
56
|
-
} else if (typeof(errback) === 'function') {
|
|
57
|
-
errback(xhr.status, url);
|
|
28
|
+
FileManager.prototype = new AbstractFileManager();
|
|
29
|
+
|
|
30
|
+
FileManager.prototype.alwaysMakePathsAbsolute = function alwaysMakePathsAbsolute() {
|
|
31
|
+
return true;
|
|
32
|
+
};
|
|
33
|
+
FileManager.prototype.join = function join(basePath, laterPath) {
|
|
34
|
+
if (!basePath) {
|
|
35
|
+
return laterPath;
|
|
58
36
|
}
|
|
59
|
-
|
|
37
|
+
return this.extractUrlParts(laterPath, basePath).path;
|
|
38
|
+
};
|
|
39
|
+
FileManager.prototype.doXHR = function doXHR(url, type, callback, errback) {
|
|
60
40
|
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
41
|
+
var xhr = getXMLHttpRequest();
|
|
42
|
+
var async = options.isFileProtocol ? options.fileAsync : options.async;
|
|
43
|
+
|
|
44
|
+
if (typeof xhr.overrideMimeType === 'function') {
|
|
45
|
+
xhr.overrideMimeType('text/css');
|
|
66
46
|
}
|
|
67
|
-
|
|
68
|
-
xhr.
|
|
69
|
-
|
|
70
|
-
|
|
47
|
+
logger.debug("XHR: Getting '" + url + "'");
|
|
48
|
+
xhr.open('GET', url, async);
|
|
49
|
+
xhr.setRequestHeader('Accept', type || 'text/x-less, text/css; q=0.9, */*; q=0.5');
|
|
50
|
+
xhr.send(null);
|
|
51
|
+
|
|
52
|
+
function handleResponse(xhr, callback, errback) {
|
|
53
|
+
if (xhr.status >= 200 && xhr.status < 300) {
|
|
54
|
+
callback(xhr.responseText,
|
|
55
|
+
xhr.getResponseHeader("Last-Modified"));
|
|
56
|
+
} else if (typeof errback === 'function') {
|
|
57
|
+
errback(xhr.status, url);
|
|
71
58
|
}
|
|
72
|
-
}
|
|
73
|
-
} else {
|
|
74
|
-
handleResponse(xhr, callback, errback);
|
|
75
|
-
}
|
|
76
|
-
};
|
|
77
|
-
FileManager.prototype.supports = function(filename, currentDirectory, options, environment) {
|
|
78
|
-
return true;
|
|
79
|
-
};
|
|
80
|
-
|
|
81
|
-
FileManager.prototype.clearFileCache = function() {
|
|
82
|
-
fileCache = {};
|
|
83
|
-
};
|
|
59
|
+
}
|
|
84
60
|
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
61
|
+
if (options.isFileProtocol && !options.fileAsync) {
|
|
62
|
+
if (xhr.status === 0 || (xhr.status >= 200 && xhr.status < 300)) {
|
|
63
|
+
callback(xhr.responseText);
|
|
64
|
+
} else {
|
|
65
|
+
errback(xhr.status, url);
|
|
66
|
+
}
|
|
67
|
+
} else if (async) {
|
|
68
|
+
xhr.onreadystatechange = function () {
|
|
69
|
+
if (xhr.readyState == 4) {
|
|
70
|
+
handleResponse(xhr, callback, errback);
|
|
71
|
+
}
|
|
72
|
+
};
|
|
73
|
+
} else {
|
|
74
|
+
handleResponse(xhr, callback, errback);
|
|
75
|
+
}
|
|
76
|
+
};
|
|
77
|
+
FileManager.prototype.supports = function(filename, currentDirectory, options, environment) {
|
|
78
|
+
return true;
|
|
79
|
+
};
|
|
80
|
+
|
|
81
|
+
FileManager.prototype.clearFileCache = function() {
|
|
82
|
+
fileCache = {};
|
|
83
|
+
};
|
|
84
|
+
|
|
85
|
+
FileManager.prototype.loadFile = function loadFile(filename, currentDirectory, options, environment, callback) {
|
|
86
|
+
if (currentDirectory && !this.isPathAbsolute(filename)) {
|
|
87
|
+
filename = currentDirectory + filename;
|
|
88
|
+
}
|
|
89
89
|
|
|
90
|
-
|
|
90
|
+
options = options || {};
|
|
91
91
|
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
92
|
+
// sheet may be set to the stylesheet for the initial load or a collection of properties including
|
|
93
|
+
// some context variables for imports
|
|
94
|
+
var hrefParts = this.extractUrlParts(filename, window.location.href);
|
|
95
|
+
var href = hrefParts.url;
|
|
96
96
|
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
97
|
+
if (options.useFileCache && fileCache[href]) {
|
|
98
|
+
try {
|
|
99
|
+
var lessText = fileCache[href];
|
|
100
|
+
callback(null, { contents: lessText, filename: href, webInfo: { lastModified: new Date() }});
|
|
101
|
+
} catch (e) {
|
|
102
|
+
callback({filename: href, message: "Error loading file " + href + " error was " + e.message});
|
|
103
|
+
}
|
|
104
|
+
return;
|
|
103
105
|
}
|
|
104
|
-
return;
|
|
105
|
-
}
|
|
106
106
|
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
107
|
+
this.doXHR(href, options.mime, function doXHRCallback(data, lastModified) {
|
|
108
|
+
// per file cache
|
|
109
|
+
fileCache[href] = data;
|
|
110
110
|
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
};
|
|
111
|
+
// Use remote copy (re-parse)
|
|
112
|
+
callback(null, { contents: data, filename: href, webInfo: { lastModified: lastModified }});
|
|
113
|
+
}, function doXHRError(status, url) {
|
|
114
|
+
callback({ type: 'File', message: "'" + url + "' wasn't found (" + status + ")", href: href });
|
|
115
|
+
});
|
|
116
|
+
};
|
|
117
117
|
|
|
118
|
-
return FileManager;
|
|
118
|
+
return FileManager;
|
|
119
119
|
};
|