less 2.2.2 → 2.6.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/Changelog.md +17 -0
- data/Gemfile +7 -3
- data/README.md +29 -13
- data/bin/lessc +3 -1
- data/less.gemspec +2 -6
- data/lib/less/defaults.rb +3 -3
- data/lib/less/java_script/rhino_context.rb +17 -27
- data/lib/less/java_script/v8_context.rb +11 -11
- data/lib/less/js/.gitattributes +10 -0
- data/lib/less/js/.gitignore +24 -0
- data/lib/less/js/.jshintrc +11 -0
- data/lib/less/js/.npmignore +1 -0
- data/lib/less/js/.travis.yml +8 -0
- data/lib/less/js/CHANGELOG.md +299 -0
- data/lib/less/js/CONTRIBUTING.md +50 -0
- data/lib/less/js/Gruntfile.js +298 -0
- data/lib/less/js/README.md +43 -12
- data/lib/less/js/benchmark/benchmark.less +194 -194
- data/lib/less/js/benchmark/less-benchmark.js +9 -10
- data/lib/less/js/bin/lessc +310 -37
- data/lib/less/js/bower.json +18 -0
- data/lib/less/js/build/README.md +51 -0
- data/lib/less/js/build/amd.js +1 -1
- data/lib/less/js/build/browser-header.js +4 -0
- data/lib/less/js/build/build.yml +162 -0
- data/lib/less/js/build/require-rhino.js +7 -2
- data/lib/less/js/build/rhino-header.js +4 -0
- data/lib/less/js/build/rhino-modules.js +131 -0
- data/lib/less/js/build/tasks/.gitkeep +1 -0
- data/lib/less/js/build.gradle +347 -0
- data/lib/less/js/dist/less-1.3.1.js +4011 -0
- data/lib/less/js/dist/less-1.3.1.min.js +9 -0
- data/lib/less/js/dist/less-1.3.2.js +4401 -0
- data/lib/less/js/dist/less-1.3.2.min.js +9 -0
- data/lib/less/js/dist/less-1.3.3.js +4413 -0
- data/lib/less/js/dist/less-1.3.3.min.js +9 -0
- data/lib/less/js/dist/less-1.4.0-beta.js +5830 -0
- data/lib/less/js/dist/less-1.4.0-beta.min.js +11 -0
- data/lib/less/js/dist/less-1.4.0.js +5830 -0
- data/lib/less/js/dist/less-1.4.0.min.js +11 -0
- data/lib/less/js/dist/less-1.4.1.js +5837 -0
- data/lib/less/js/dist/less-1.4.1.min.js +11 -0
- data/lib/less/js/dist/less-1.4.2.js +5837 -0
- data/lib/less/js/dist/less-1.4.2.min.js +11 -0
- data/lib/less/js/dist/less-1.5.0.js +6914 -0
- data/lib/less/js/dist/less-1.5.0.min.js +13 -0
- data/lib/less/js/dist/less-1.5.1.js +6941 -0
- data/lib/less/js/dist/less-1.5.1.min.js +13 -0
- data/lib/less/js/dist/less-1.6.0.js +7485 -0
- data/lib/less/js/dist/less-1.6.0.min.js +16 -0
- data/lib/less/js/dist/less-1.6.1.js +7513 -0
- data/lib/less/js/dist/less-1.6.1.min.js +16 -0
- data/lib/less/js/dist/less-1.6.2.js +7624 -0
- data/lib/less/js/dist/less-1.6.2.min.js +16 -0
- data/lib/less/js/dist/less-1.6.3.js +7627 -0
- data/lib/less/js/dist/less-1.6.3.min.js +16 -0
- data/lib/less/js/dist/less-1.7.0.js +7921 -0
- data/lib/less/js/dist/less-1.7.0.min.js +16 -0
- data/lib/less/js/dist/less-rhino-1.3.1.js +3725 -0
- data/lib/less/js/dist/less-rhino-1.3.2.js +3990 -0
- data/lib/less/js/dist/less-rhino-1.3.3.js +4002 -0
- data/lib/less/js/dist/less-rhino-1.4.0.js +4273 -0
- data/lib/less/js/dist/less-rhino-1.5.1.js +6831 -0
- data/lib/less/js/dist/less-rhino-1.6.2.js +9017 -0
- data/lib/less/js/dist/less-rhino-1.6.3.js +9020 -0
- data/lib/less/js/dist/less-rhino-1.7.0.js +9301 -0
- data/lib/less/js/dist/lessc-rhino-1.6.2.js +449 -0
- data/lib/less/js/dist/lessc-rhino-1.6.3.js +449 -0
- data/lib/less/js/dist/lessc-rhino-1.7.0.js +449 -0
- data/lib/less/js/gradle/wrapper/gradle-wrapper.jar +0 -0
- data/lib/less/js/gradle/wrapper/gradle-wrapper.properties +6 -0
- data/lib/less/js/gradlew +164 -0
- data/lib/less/js/gradlew.bat +90 -0
- data/lib/less/js/lib/less/browser.js +547 -250
- data/lib/less/js/lib/less/encoder.js +4 -0
- data/lib/less/js/lib/less/env.js +136 -0
- data/lib/less/js/lib/less/extend-visitor.js +416 -0
- data/lib/less/js/lib/less/functions.js +576 -36
- data/lib/less/js/lib/less/import-visitor.js +142 -0
- data/lib/less/js/lib/less/index.js +187 -83
- data/lib/less/js/lib/less/join-selector-visitor.js +44 -0
- data/lib/less/js/lib/less/lessc_helper.js +82 -0
- data/lib/less/js/lib/less/parser.js +1286 -523
- data/lib/less/js/lib/less/rhino.js +415 -29
- data/lib/less/js/lib/less/source-map-output.js +141 -0
- data/lib/less/js/lib/less/to-css-visitor.js +240 -0
- data/lib/less/js/lib/less/tree/alpha.js +17 -5
- data/lib/less/js/lib/less/tree/anonymous.js +25 -4
- data/lib/less/js/lib/less/tree/assignment.js +17 -5
- data/lib/less/js/lib/less/tree/call.js +36 -13
- data/lib/less/js/lib/less/tree/color.js +119 -31
- data/lib/less/js/lib/less/tree/comment.js +18 -4
- data/lib/less/js/lib/less/tree/condition.js +35 -28
- data/lib/less/js/lib/less/tree/detached-ruleset.js +20 -0
- data/lib/less/js/lib/less/tree/dimension.js +291 -16
- data/lib/less/js/lib/less/tree/directive.js +56 -22
- data/lib/less/js/lib/less/tree/element.js +78 -17
- data/lib/less/js/lib/less/tree/expression.js +39 -8
- data/lib/less/js/lib/less/tree/extend.js +53 -0
- data/lib/less/js/lib/less/tree/import.js +81 -36
- data/lib/less/js/lib/less/tree/javascript.js +17 -10
- data/lib/less/js/lib/less/tree/keyword.js +8 -3
- data/lib/less/js/lib/less/tree/media.js +70 -27
- data/lib/less/js/lib/less/tree/mixin.js +250 -70
- data/lib/less/js/lib/less/tree/negative.js +24 -0
- data/lib/less/js/lib/less/tree/operation.js +38 -13
- data/lib/less/js/lib/less/tree/paren.js +9 -2
- data/lib/less/js/lib/less/tree/quoted.js +29 -10
- data/lib/less/js/lib/less/tree/rule.js +77 -29
- data/lib/less/js/lib/less/tree/ruleset-call.js +16 -0
- data/lib/less/js/lib/less/tree/ruleset.js +445 -107
- data/lib/less/js/lib/less/tree/selector.js +117 -30
- data/lib/less/js/lib/less/tree/unicode-descriptor.js +15 -0
- data/lib/less/js/lib/less/tree/url.js +43 -15
- data/lib/less/js/lib/less/tree/value.js +16 -6
- data/lib/less/js/lib/less/tree/variable.js +26 -8
- data/lib/less/js/lib/less/tree.js +82 -2
- data/lib/less/js/lib/less/visitor.js +146 -0
- data/lib/less/js/lib/source-map/source-map-0.1.31.js +1933 -0
- data/lib/less/js/lib/source-map/source-map-footer.js +4 -0
- data/lib/less/js/lib/source-map/source-map-header.js +3 -0
- data/lib/less/js/package.json +86 -11
- data/lib/less/js/test/browser/common.js +201 -0
- data/lib/less/js/test/browser/css/global-vars/simple.css +3 -0
- data/lib/less/js/test/browser/css/modify-vars/simple.css +8 -0
- data/lib/less/js/test/browser/css/postProcessor/postProcessor.css +4 -0
- data/lib/less/js/test/browser/css/relative-urls/urls.css +35 -0
- data/lib/less/js/test/browser/css/rootpath/urls.css +35 -0
- data/lib/less/js/test/browser/css/rootpath-relative/urls.css +35 -0
- data/lib/less/js/test/browser/css/urls.css +53 -0
- data/lib/less/js/test/browser/es5.js +27 -0
- data/lib/less/js/test/browser/jasmine-html.js +681 -0
- data/lib/less/js/test/browser/jasmine.css +82 -0
- data/lib/less/js/test/browser/jasmine.js +2600 -0
- data/lib/less/js/test/browser/less/console-errors/test-error.less +3 -0
- data/lib/less/js/test/browser/less/console-errors/test-error.txt +2 -0
- data/lib/less/js/test/browser/less/global-vars/simple.less +3 -0
- data/lib/less/js/test/browser/less/imports/urls.less +4 -0
- data/lib/less/js/test/browser/less/imports/urls2.less +4 -0
- data/lib/less/js/test/browser/less/modify-vars/imports/simple2.less +4 -0
- data/lib/less/js/test/browser/less/modify-vars/simple.less +8 -0
- data/lib/less/js/test/browser/less/postProcessor/postProcessor.less +4 -0
- data/lib/less/js/test/browser/less/relative-urls/urls.less +33 -0
- data/lib/less/js/test/browser/less/rootpath/urls.less +33 -0
- data/lib/less/js/test/browser/less/rootpath-relative/urls.less +33 -0
- data/lib/less/js/test/browser/less/urls.less +57 -0
- data/lib/less/js/test/browser/phantom-runner.js +150 -0
- data/lib/less/js/test/browser/runner-browser-options.js +42 -0
- data/lib/less/js/test/browser/runner-browser-spec.js +12 -0
- data/lib/less/js/test/browser/runner-console-errors.js +5 -0
- data/lib/less/js/test/browser/runner-errors-options.js +5 -0
- data/lib/less/js/test/browser/runner-errors-spec.js +4 -0
- data/lib/less/js/test/browser/runner-global-vars-options.js +4 -0
- data/lib/less/js/test/browser/runner-global-vars-spec.js +3 -0
- data/lib/less/js/test/browser/runner-legacy-options.js +4 -0
- data/lib/less/js/test/browser/runner-legacy-spec.js +3 -0
- data/lib/less/js/test/browser/runner-main-options.js +15 -0
- data/lib/less/js/test/browser/runner-main-spec.js +3 -0
- data/lib/less/js/test/browser/runner-modify-vars-options.js +2 -0
- data/lib/less/js/test/browser/runner-modify-vars-spec.js +43 -0
- data/lib/less/js/test/browser/runner-no-js-errors-options.js +4 -0
- data/lib/less/js/test/browser/runner-no-js-errors-spec.js +4 -0
- data/lib/less/js/test/browser/runner-postProcessor-options.js +4 -0
- data/lib/less/js/test/browser/runner-postProcessor.js +3 -0
- data/lib/less/js/test/browser/runner-production-options.js +3 -0
- data/lib/less/js/test/browser/runner-production-spec.js +5 -0
- data/lib/less/js/test/browser/runner-relative-urls-options.js +3 -0
- data/lib/less/js/test/browser/runner-relative-urls-spec.js +3 -0
- data/lib/less/js/test/browser/runner-rootpath-options.js +3 -0
- data/lib/less/js/test/browser/runner-rootpath-relative-options.js +4 -0
- data/lib/less/js/test/browser/runner-rootpath-relative-spec.js +3 -0
- data/lib/less/js/test/browser/runner-rootpath-spec.js +3 -0
- data/lib/less/js/test/browser/test-runner-template.tmpl +47 -0
- data/lib/less/js/test/css/charsets.css +1 -0
- data/lib/less/js/test/css/colors.css +29 -0
- data/lib/less/js/test/css/comments.css +15 -2
- data/lib/less/js/test/css/compression/compression.css +3 -0
- data/lib/less/js/test/css/css-3.css +73 -2
- data/lib/less/js/test/css/css-escapes.css +4 -0
- data/lib/less/js/test/css/css-guards.css +37 -0
- data/lib/less/js/test/css/css.css +20 -14
- data/lib/less/js/test/css/debug/linenumbers-all.css +49 -0
- data/lib/less/js/test/css/debug/linenumbers-comments.css +40 -0
- data/lib/less/js/test/css/debug/linenumbers-mediaquery.css +40 -0
- data/lib/less/js/test/css/detached-rulesets.css +71 -0
- data/lib/less/js/test/css/empty.css +0 -0
- data/lib/less/js/test/css/extend-chaining.css +81 -0
- data/lib/less/js/test/css/extend-clearfix.css +19 -0
- data/lib/less/js/test/css/extend-exact.css +37 -0
- data/lib/less/js/test/css/extend-media.css +24 -0
- data/lib/less/js/test/css/extend-nest.css +57 -0
- data/lib/less/js/test/css/extend-selector.css +80 -0
- data/lib/less/js/test/css/extend.css +76 -0
- data/lib/less/js/test/css/extract-and-length.css +133 -0
- data/lib/less/js/test/css/functions.css +117 -2
- data/lib/less/js/test/css/globalVars/extended.css +12 -0
- data/lib/less/js/test/css/globalVars/simple.css +6 -0
- data/lib/less/js/test/css/ie-filters.css +7 -3
- data/lib/less/js/test/css/import-inline.css +5 -0
- data/lib/less/js/test/css/import-interpolation.css +6 -0
- data/lib/less/js/test/css/import-once.css +15 -0
- data/lib/less/js/test/css/import-reference.css +68 -0
- data/lib/less/js/test/css/import.css +23 -10
- data/lib/less/js/test/css/javascript.css +3 -2
- data/lib/less/js/test/css/legacy/legacy.css +7 -0
- data/lib/less/js/test/css/media.css +141 -1
- data/lib/less/js/test/css/merge.css +34 -0
- data/lib/less/js/test/css/mixins-args.css +41 -4
- data/lib/less/js/test/css/mixins-guards-default-func.css +129 -0
- data/lib/less/js/test/css/mixins-guards.css +24 -0
- data/lib/less/js/test/css/mixins-important.css +28 -0
- data/lib/less/js/test/css/mixins-interpolated.css +39 -0
- data/lib/less/js/test/css/mixins-named-args.css +27 -0
- data/lib/less/js/test/css/mixins-pattern.css +4 -0
- data/lib/less/js/test/css/mixins.css +70 -0
- data/lib/less/js/test/css/modifyVars/extended.css +9 -0
- data/lib/less/js/test/css/no-output.css +0 -0
- data/lib/less/js/test/css/parens.css +21 -5
- data/lib/less/js/test/css/property-name-interp.css +20 -0
- data/lib/less/js/test/css/scope.css +23 -0
- data/lib/less/js/test/css/selectors.css +84 -0
- data/lib/less/js/test/css/static-urls/urls.css +45 -0
- data/lib/less/js/test/css/strings.css +5 -2
- data/lib/less/js/test/css/url-args/urls.css +56 -0
- data/lib/less/js/test/css/urls.css +71 -0
- data/lib/less/js/test/css/variables-in-at-rules.css +18 -0
- data/lib/less/js/test/css/variables.css +22 -4
- data/lib/less/js/test/css/whitespace.css +4 -0
- data/lib/less/js/test/data/data-uri-fail.png +0 -0
- data/lib/less/js/test/data/image.jpg +1 -0
- data/lib/less/js/test/data/page.html +1 -0
- data/lib/less/js/test/index.js +45 -0
- data/lib/less/js/test/less/charsets.less +3 -0
- data/lib/less/js/test/less/colors.less +37 -4
- data/lib/less/js/test/less/comments.less +21 -3
- data/lib/less/js/test/less/compression/compression.less +36 -0
- data/lib/less/js/test/less/css-3.less +70 -6
- data/lib/less/js/test/less/css-escapes.less +6 -1
- data/lib/less/js/test/less/css-guards.less +102 -0
- data/lib/less/js/test/less/css.less +23 -15
- data/lib/less/js/test/less/debug/import/test.less +25 -0
- data/lib/less/js/test/less/debug/linenumbers.less +33 -0
- data/lib/less/js/test/less/detached-rulesets.less +103 -0
- data/lib/less/js/test/less/empty.less +0 -0
- data/lib/less/js/test/less/errors/add-mixed-units.less +3 -0
- data/lib/less/js/test/less/errors/add-mixed-units.txt +4 -0
- data/lib/less/js/test/less/errors/add-mixed-units2.less +3 -0
- data/lib/less/js/test/less/errors/add-mixed-units2.txt +4 -0
- data/lib/less/js/test/less/errors/at-rules-undefined-var.less +4 -0
- data/lib/less/js/test/less/errors/at-rules-undefined-var.txt +4 -0
- data/lib/less/js/test/less/errors/bad-variable-declaration1.less +1 -0
- data/lib/less/js/test/less/errors/bad-variable-declaration1.txt +2 -0
- data/lib/less/js/test/less/errors/color-func-invalid-color.less +3 -0
- data/lib/less/js/test/less/errors/color-func-invalid-color.txt +4 -0
- data/lib/less/js/test/less/errors/comment-in-selector.less +1 -0
- data/lib/less/js/test/less/errors/comment-in-selector.txt +2 -0
- data/lib/less/js/test/less/errors/css-guard-default-func.less +4 -0
- data/lib/less/js/test/less/errors/css-guard-default-func.txt +4 -0
- data/lib/less/js/test/less/errors/detached-ruleset-1.less +6 -0
- data/lib/less/js/test/less/errors/detached-ruleset-1.txt +4 -0
- data/lib/less/js/test/less/errors/detached-ruleset-2.less +6 -0
- data/lib/less/js/test/less/errors/detached-ruleset-2.txt +4 -0
- data/lib/less/js/test/less/errors/detached-ruleset-3.less +4 -0
- data/lib/less/js/test/less/errors/detached-ruleset-3.txt +4 -0
- data/lib/less/js/test/less/errors/detached-ruleset-4.less +5 -0
- data/lib/less/js/test/less/errors/detached-ruleset-4.txt +3 -0
- data/lib/less/js/test/less/errors/detached-ruleset-5.less +4 -0
- data/lib/less/js/test/less/errors/detached-ruleset-5.txt +3 -0
- data/lib/less/js/test/less/errors/detached-ruleset-6.less +5 -0
- data/lib/less/js/test/less/errors/detached-ruleset-6.txt +4 -0
- data/lib/less/js/test/less/errors/divide-mixed-units.less +3 -0
- data/lib/less/js/test/less/errors/divide-mixed-units.txt +4 -0
- data/lib/less/js/test/less/errors/extend-no-selector.less +3 -0
- data/lib/less/js/test/less/errors/extend-no-selector.txt +3 -0
- data/lib/less/js/test/less/errors/extend-not-at-end.less +3 -0
- data/lib/less/js/test/less/errors/extend-not-at-end.txt +3 -0
- data/lib/less/js/test/less/errors/import-missing.less +6 -0
- data/lib/less/js/test/less/errors/import-missing.txt +3 -0
- data/lib/less/js/test/less/errors/import-no-semi.less +1 -0
- data/lib/less/js/test/less/errors/import-no-semi.txt +2 -0
- data/lib/less/js/test/less/errors/import-subfolder1.less +1 -0
- data/lib/less/js/test/less/errors/import-subfolder1.txt +3 -0
- data/lib/less/js/test/less/errors/import-subfolder2.less +1 -0
- data/lib/less/js/test/less/errors/import-subfolder2.txt +4 -0
- data/lib/less/js/test/less/errors/imports/import-subfolder1.less +1 -0
- data/lib/less/js/test/less/errors/imports/import-subfolder2.less +1 -0
- data/lib/less/js/test/less/errors/imports/import-test.less +4 -0
- data/lib/less/js/test/less/errors/imports/subfolder/mixin-not-defined.less +1 -0
- data/lib/less/js/test/less/errors/imports/subfolder/parse-error-curly-bracket.less +1 -0
- data/lib/less/js/test/less/errors/javascript-error.less +3 -0
- data/lib/less/js/test/less/errors/javascript-error.txt +4 -0
- data/lib/less/js/test/less/errors/javascript-undefined-var.less +3 -0
- data/lib/less/js/test/less/errors/javascript-undefined-var.txt +4 -0
- data/lib/less/js/test/less/errors/mixed-mixin-definition-args-1.less +6 -0
- data/lib/less/js/test/less/errors/mixed-mixin-definition-args-1.txt +4 -0
- data/lib/less/js/test/less/errors/mixed-mixin-definition-args-2.less +6 -0
- data/lib/less/js/test/less/errors/mixed-mixin-definition-args-2.txt +4 -0
- data/lib/less/js/test/less/errors/mixin-not-defined.less +11 -0
- data/lib/less/js/test/less/errors/mixin-not-defined.txt +3 -0
- data/lib/less/js/test/less/errors/mixin-not-matched.less +6 -0
- data/lib/less/js/test/less/errors/mixin-not-matched.txt +3 -0
- data/lib/less/js/test/less/errors/mixin-not-matched2.less +6 -0
- data/lib/less/js/test/less/errors/mixin-not-matched2.txt +3 -0
- data/lib/less/js/test/less/errors/mixin-not-visible-in-scope-1.less +9 -0
- data/lib/less/js/test/less/errors/mixin-not-visible-in-scope-1.txt +4 -0
- data/lib/less/js/test/less/errors/mixins-guards-default-func-1.less +9 -0
- data/lib/less/js/test/less/errors/mixins-guards-default-func-1.txt +4 -0
- data/lib/less/js/test/less/errors/mixins-guards-default-func-2.less +9 -0
- data/lib/less/js/test/less/errors/mixins-guards-default-func-2.txt +4 -0
- data/lib/less/js/test/less/errors/mixins-guards-default-func-3.less +9 -0
- data/lib/less/js/test/less/errors/mixins-guards-default-func-3.txt +4 -0
- data/lib/less/js/test/less/errors/multiple-guards-on-css-selectors.less +4 -0
- data/lib/less/js/test/less/errors/multiple-guards-on-css-selectors.txt +4 -0
- data/lib/less/js/test/less/errors/multiple-guards-on-css-selectors2.less +4 -0
- data/lib/less/js/test/less/errors/multiple-guards-on-css-selectors2.txt +4 -0
- data/lib/less/js/test/less/errors/multiply-mixed-units.less +7 -0
- data/lib/less/js/test/less/errors/multiply-mixed-units.txt +4 -0
- data/lib/less/js/test/less/errors/parens-error-1.less +3 -0
- data/lib/less/js/test/less/errors/parens-error-1.txt +4 -0
- data/lib/less/js/test/less/errors/parens-error-2.less +3 -0
- data/lib/less/js/test/less/errors/parens-error-2.txt +4 -0
- data/lib/less/js/test/less/errors/parens-error-3.less +3 -0
- data/lib/less/js/test/less/errors/parens-error-3.txt +4 -0
- data/lib/less/js/test/less/errors/parse-error-curly-bracket.less +4 -0
- data/lib/less/js/test/less/errors/parse-error-curly-bracket.txt +4 -0
- data/lib/less/js/test/less/errors/parse-error-extra-parens.less +5 -0
- data/lib/less/js/test/less/errors/parse-error-extra-parens.txt +3 -0
- data/lib/less/js/test/less/errors/parse-error-missing-bracket.less +2 -0
- data/lib/less/js/test/less/errors/parse-error-missing-bracket.txt +3 -0
- data/lib/less/js/test/less/errors/parse-error-missing-parens.less +5 -0
- data/lib/less/js/test/less/errors/parse-error-missing-parens.txt +3 -0
- data/lib/less/js/test/less/errors/parse-error-with-import.less +13 -0
- data/lib/less/js/test/less/errors/parse-error-with-import.txt +4 -0
- data/lib/less/js/test/less/errors/percentage-missing-space.less +3 -0
- data/lib/less/js/test/less/errors/percentage-missing-space.txt +4 -0
- data/lib/less/js/test/less/errors/property-asterisk-only-name.less +3 -0
- data/lib/less/js/test/less/errors/property-asterisk-only-name.txt +4 -0
- data/lib/less/js/test/less/errors/property-ie5-hack.less +3 -0
- data/lib/less/js/test/less/errors/property-ie5-hack.txt +4 -0
- data/lib/less/js/test/less/errors/property-in-root.less +4 -0
- data/lib/less/js/test/less/errors/property-in-root.txt +4 -0
- data/lib/less/js/test/less/errors/property-in-root2.less +1 -0
- data/lib/less/js/test/less/errors/property-in-root2.txt +4 -0
- data/lib/less/js/test/less/errors/property-in-root3.less +4 -0
- data/lib/less/js/test/less/errors/property-in-root3.txt +3 -0
- data/lib/less/js/test/less/errors/property-interp-not-defined.less +1 -0
- data/lib/less/js/test/less/errors/property-interp-not-defined.txt +2 -0
- data/lib/less/js/test/less/errors/recursive-variable.less +1 -0
- data/lib/less/js/test/less/errors/recursive-variable.txt +2 -0
- data/lib/less/js/test/less/errors/svg-gradient1.less +3 -0
- data/lib/less/js/test/less/errors/svg-gradient1.txt +4 -0
- data/lib/less/js/test/less/errors/svg-gradient2.less +3 -0
- data/lib/less/js/test/less/errors/svg-gradient2.txt +4 -0
- data/lib/less/js/test/less/errors/svg-gradient3.less +3 -0
- data/lib/less/js/test/less/errors/svg-gradient3.txt +4 -0
- data/lib/less/js/test/less/errors/unit-function.less +3 -0
- data/lib/less/js/test/less/errors/unit-function.txt +4 -0
- data/lib/less/js/test/less/extend-chaining.less +91 -0
- data/lib/less/js/test/less/extend-clearfix.less +19 -0
- data/lib/less/js/test/less/extend-exact.less +46 -0
- data/lib/less/js/test/less/extend-media.less +24 -0
- data/lib/less/js/test/less/extend-nest.less +65 -0
- data/lib/less/js/test/less/extend-selector.less +99 -0
- data/lib/less/js/test/less/extend.less +81 -0
- data/lib/less/js/test/less/extract-and-length.less +133 -0
- data/lib/less/js/test/less/functions.less +130 -6
- data/lib/less/js/test/less/globalVars/extended.json +5 -0
- data/lib/less/js/test/less/globalVars/extended.less +10 -0
- data/lib/less/js/test/less/globalVars/simple.json +3 -0
- data/lib/less/js/test/less/globalVars/simple.less +3 -0
- data/lib/less/js/test/less/ie-filters.less +7 -0
- data/lib/less/js/test/less/import/deeper/import-once-test-a.less +1 -0
- data/lib/less/js/test/less/import/import-and-relative-paths-test.less +17 -0
- data/lib/less/js/test/less/import/import-charset-test.less +1 -0
- data/lib/less/js/test/less/import/import-interpolation.less +1 -0
- data/lib/less/js/test/less/import/import-interpolation2.less +5 -0
- data/lib/less/js/test/less/import/import-once-test-c.less +6 -0
- data/lib/less/js/test/less/import/import-reference.less +51 -0
- data/lib/less/js/test/less/import/import-test-a.less +1 -0
- data/lib/less/js/test/less/import/import-test-c.less +0 -1
- data/lib/less/js/test/less/import/import-test-f.less +5 -0
- data/lib/less/js/test/less/import/imports/font.less +8 -0
- data/lib/less/js/test/less/import/imports/logo.less +5 -0
- data/lib/less/js/test/less/import/invalid-css.less +1 -0
- data/lib/less/js/test/less/import/urls.less +1 -0
- data/lib/less/js/test/less/import-inline.less +2 -0
- data/lib/less/js/test/less/import-interpolation.less +8 -0
- data/lib/less/js/test/less/import-once.less +6 -0
- data/lib/less/js/test/less/import-reference.less +21 -0
- data/lib/less/js/test/less/import.less +13 -3
- data/lib/less/js/test/less/javascript.less +5 -3
- data/lib/less/js/test/less/legacy/legacy.less +7 -0
- data/lib/less/js/test/less/media.less +158 -3
- data/lib/less/js/test/less/merge.less +78 -0
- data/lib/less/js/test/less/mixins-args.less +93 -15
- data/lib/less/js/test/less/mixins-guards-default-func.less +195 -0
- data/lib/less/js/test/less/mixins-guards.less +65 -0
- data/lib/less/js/test/less/mixins-important.less +8 -1
- data/lib/less/js/test/less/mixins-interpolated.less +69 -0
- data/lib/less/js/test/less/mixins-named-args.less +36 -0
- data/lib/less/js/test/less/mixins-nested.less +2 -2
- data/lib/less/js/test/less/mixins-pattern.less +4 -1
- data/lib/less/js/test/less/mixins.less +74 -0
- data/lib/less/js/test/less/modifyVars/extended.json +5 -0
- data/lib/less/js/test/less/modifyVars/extended.less +11 -0
- data/lib/less/js/test/less/no-js-errors/no-js-errors.less +3 -0
- data/lib/less/js/test/less/no-js-errors/no-js-errors.txt +4 -0
- data/lib/less/js/test/less/no-output.less +2 -0
- data/lib/less/js/test/less/operations.less +27 -27
- data/lib/less/js/test/less/parens.less +24 -5
- data/lib/less/js/test/less/property-name-interp.less +53 -0
- data/lib/less/js/test/less/scope.less +73 -1
- data/lib/less/js/test/less/selectors.less +101 -0
- data/lib/less/js/test/less/sourcemaps/basic.json +3 -0
- data/lib/less/js/test/less/sourcemaps/basic.less +27 -0
- data/lib/less/js/test/less/sourcemaps/imported.css +7 -0
- data/lib/less/js/test/less/static-urls/urls.less +33 -0
- data/lib/less/js/test/less/strings.less +7 -1
- data/lib/less/js/test/less/url-args/urls.less +63 -0
- data/lib/less/js/test/less/urls.less +72 -0
- data/lib/less/js/test/less/variables-in-at-rules.less +20 -0
- data/lib/less/js/test/less/variables.less +42 -13
- data/lib/less/js/test/less/whitespace.less +7 -0
- data/lib/less/js/test/less-test.js +251 -65
- data/lib/less/js/test/rhino/test-header.js +15 -0
- data/lib/less/js/test/sourcemaps/basic.json +1 -0
- data/lib/less/js/test/sourcemaps/index.html +17 -0
- data/lib/less/loader.rb +191 -27
- data/lib/less/parser.rb +47 -8
- data/lib/less/version.rb +2 -2
- data/spec/less/loader_spec.rb +45 -0
- data/spec/less/parser_spec.rb +43 -17
- data/spec/less/some/some.css +0 -0
- data/spec/less/some/some.less +4 -0
- metadata +352 -57
- data/lib/less/js/CHANGELOG +0 -41
- data/lib/less/js/Makefile +0 -75
- data/lib/less/js/build/ecma-5.js +0 -120
- data/lib/less/js/build/header.js +0 -7
- data/lib/less/js/lib/less/cssmin.js +0 -355
@@ -0,0 +1,142 @@
|
|
1
|
+
(function (tree) {
|
2
|
+
tree.importVisitor = function(importer, finish, evalEnv, onceFileDetectionMap, recursionDetector) {
|
3
|
+
this._visitor = new tree.visitor(this);
|
4
|
+
this._importer = importer;
|
5
|
+
this._finish = finish;
|
6
|
+
this.env = evalEnv || new tree.evalEnv();
|
7
|
+
this.importCount = 0;
|
8
|
+
this.onceFileDetectionMap = onceFileDetectionMap || {};
|
9
|
+
this.recursionDetector = {};
|
10
|
+
if (recursionDetector) {
|
11
|
+
for(var fullFilename in recursionDetector) {
|
12
|
+
if (recursionDetector.hasOwnProperty(fullFilename)) {
|
13
|
+
this.recursionDetector[fullFilename] = true;
|
14
|
+
}
|
15
|
+
}
|
16
|
+
}
|
17
|
+
};
|
18
|
+
|
19
|
+
tree.importVisitor.prototype = {
|
20
|
+
isReplacing: true,
|
21
|
+
run: function (root) {
|
22
|
+
var error;
|
23
|
+
try {
|
24
|
+
// process the contents
|
25
|
+
this._visitor.visit(root);
|
26
|
+
}
|
27
|
+
catch(e) {
|
28
|
+
error = e;
|
29
|
+
}
|
30
|
+
|
31
|
+
this.isFinished = true;
|
32
|
+
|
33
|
+
if (this.importCount === 0) {
|
34
|
+
this._finish(error);
|
35
|
+
}
|
36
|
+
},
|
37
|
+
visitImport: function (importNode, visitArgs) {
|
38
|
+
var importVisitor = this,
|
39
|
+
evaldImportNode,
|
40
|
+
inlineCSS = importNode.options.inline;
|
41
|
+
|
42
|
+
if (!importNode.css || inlineCSS) {
|
43
|
+
|
44
|
+
try {
|
45
|
+
evaldImportNode = importNode.evalForImport(this.env);
|
46
|
+
} catch(e){
|
47
|
+
if (!e.filename) { e.index = importNode.index; e.filename = importNode.currentFileInfo.filename; }
|
48
|
+
// attempt to eval properly and treat as css
|
49
|
+
importNode.css = true;
|
50
|
+
// if that fails, this error will be thrown
|
51
|
+
importNode.error = e;
|
52
|
+
}
|
53
|
+
|
54
|
+
if (evaldImportNode && (!evaldImportNode.css || inlineCSS)) {
|
55
|
+
importNode = evaldImportNode;
|
56
|
+
this.importCount++;
|
57
|
+
var env = new tree.evalEnv(this.env, this.env.frames.slice(0));
|
58
|
+
|
59
|
+
if (importNode.options.multiple) {
|
60
|
+
env.importMultiple = true;
|
61
|
+
}
|
62
|
+
|
63
|
+
this._importer.push(importNode.getPath(), importNode.currentFileInfo, importNode.options, function (e, root, importedAtRoot, fullPath) {
|
64
|
+
if (e && !e.filename) { e.index = importNode.index; e.filename = importNode.currentFileInfo.filename; }
|
65
|
+
|
66
|
+
if (!env.importMultiple) {
|
67
|
+
if (importedAtRoot) {
|
68
|
+
importNode.skip = true;
|
69
|
+
} else {
|
70
|
+
importNode.skip = function() {
|
71
|
+
if (fullPath in importVisitor.onceFileDetectionMap) {
|
72
|
+
return true;
|
73
|
+
}
|
74
|
+
importVisitor.onceFileDetectionMap[fullPath] = true;
|
75
|
+
return false;
|
76
|
+
};
|
77
|
+
}
|
78
|
+
}
|
79
|
+
|
80
|
+
var subFinish = function(e) {
|
81
|
+
importVisitor.importCount--;
|
82
|
+
|
83
|
+
if (importVisitor.importCount === 0 && importVisitor.isFinished) {
|
84
|
+
importVisitor._finish(e);
|
85
|
+
}
|
86
|
+
};
|
87
|
+
|
88
|
+
if (root) {
|
89
|
+
importNode.root = root;
|
90
|
+
importNode.importedFilename = fullPath;
|
91
|
+
var duplicateImport = importedAtRoot || fullPath in importVisitor.recursionDetector;
|
92
|
+
|
93
|
+
if (!inlineCSS && (env.importMultiple || !duplicateImport)) {
|
94
|
+
importVisitor.recursionDetector[fullPath] = true;
|
95
|
+
new(tree.importVisitor)(importVisitor._importer, subFinish, env, importVisitor.onceFileDetectionMap, importVisitor.recursionDetector)
|
96
|
+
.run(root);
|
97
|
+
return;
|
98
|
+
}
|
99
|
+
}
|
100
|
+
|
101
|
+
subFinish();
|
102
|
+
});
|
103
|
+
}
|
104
|
+
}
|
105
|
+
visitArgs.visitDeeper = false;
|
106
|
+
return importNode;
|
107
|
+
},
|
108
|
+
visitRule: function (ruleNode, visitArgs) {
|
109
|
+
visitArgs.visitDeeper = false;
|
110
|
+
return ruleNode;
|
111
|
+
},
|
112
|
+
visitDirective: function (directiveNode, visitArgs) {
|
113
|
+
this.env.frames.unshift(directiveNode);
|
114
|
+
return directiveNode;
|
115
|
+
},
|
116
|
+
visitDirectiveOut: function (directiveNode) {
|
117
|
+
this.env.frames.shift();
|
118
|
+
},
|
119
|
+
visitMixinDefinition: function (mixinDefinitionNode, visitArgs) {
|
120
|
+
this.env.frames.unshift(mixinDefinitionNode);
|
121
|
+
return mixinDefinitionNode;
|
122
|
+
},
|
123
|
+
visitMixinDefinitionOut: function (mixinDefinitionNode) {
|
124
|
+
this.env.frames.shift();
|
125
|
+
},
|
126
|
+
visitRuleset: function (rulesetNode, visitArgs) {
|
127
|
+
this.env.frames.unshift(rulesetNode);
|
128
|
+
return rulesetNode;
|
129
|
+
},
|
130
|
+
visitRulesetOut: function (rulesetNode) {
|
131
|
+
this.env.frames.shift();
|
132
|
+
},
|
133
|
+
visitMedia: function (mediaNode, visitArgs) {
|
134
|
+
this.env.frames.unshift(mediaNode.ruleset);
|
135
|
+
return mediaNode;
|
136
|
+
},
|
137
|
+
visitMediaOut: function (mediaNode) {
|
138
|
+
this.env.frames.shift();
|
139
|
+
}
|
140
|
+
};
|
141
|
+
|
142
|
+
})(require('./tree'));
|
@@ -1,17 +1,18 @@
|
|
1
1
|
var path = require('path'),
|
2
|
-
|
2
|
+
url = require('url'),
|
3
|
+
request,
|
3
4
|
fs = require('fs');
|
4
5
|
|
5
6
|
var less = {
|
6
|
-
version: [1,
|
7
|
+
version: [1, 7, 0],
|
7
8
|
Parser: require('./parser').Parser,
|
8
|
-
importer: require('./parser').importer,
|
9
9
|
tree: require('./tree'),
|
10
10
|
render: function (input, options, callback) {
|
11
11
|
options = options || {};
|
12
12
|
|
13
13
|
if (typeof(options) === 'function') {
|
14
|
-
callback = options
|
14
|
+
callback = options;
|
15
|
+
options = {};
|
15
16
|
}
|
16
17
|
|
17
18
|
var parser = new(less.Parser)(options),
|
@@ -19,130 +20,233 @@ var less = {
|
|
19
20
|
|
20
21
|
if (callback) {
|
21
22
|
parser.parse(input, function (e, root) {
|
22
|
-
|
23
|
+
if (e) { callback(e); return; }
|
24
|
+
var css;
|
25
|
+
try {
|
26
|
+
css = root && root.toCSS && root.toCSS(options);
|
27
|
+
}
|
28
|
+
catch (err) { callback(err); return; }
|
29
|
+
callback(null, css);
|
23
30
|
});
|
24
31
|
} else {
|
25
|
-
ee = new(require('events').EventEmitter);
|
32
|
+
ee = new (require('events').EventEmitter)();
|
26
33
|
|
27
34
|
process.nextTick(function () {
|
28
35
|
parser.parse(input, function (e, root) {
|
29
|
-
if (e) { ee.emit('error', e) }
|
30
|
-
|
36
|
+
if (e) { return ee.emit('error', e); }
|
37
|
+
try { ee.emit('success', root.toCSS(options)); }
|
38
|
+
catch (err) { ee.emit('error', err); }
|
31
39
|
});
|
32
40
|
});
|
33
41
|
return ee;
|
34
42
|
}
|
35
43
|
},
|
36
|
-
|
44
|
+
formatError: function(ctx, options) {
|
37
45
|
options = options || {};
|
38
46
|
|
39
47
|
var message = "";
|
40
48
|
var extract = ctx.extract;
|
41
49
|
var error = [];
|
42
|
-
var stylize = options.color ?
|
43
|
-
|
44
|
-
if (options.silent) { return }
|
50
|
+
var stylize = options.color ? require('./lessc_helper').stylize : function (str) { return str; };
|
45
51
|
|
46
|
-
|
52
|
+
// only output a stack if it isn't a less error
|
53
|
+
if (ctx.stack && !ctx.type) { return stylize(ctx.stack, 'red'); }
|
47
54
|
|
48
|
-
if (!ctx.hasOwnProperty('index')) {
|
49
|
-
return
|
55
|
+
if (!ctx.hasOwnProperty('index') || !extract) {
|
56
|
+
return ctx.stack || ctx.message;
|
50
57
|
}
|
51
58
|
|
52
59
|
if (typeof(extract[0]) === 'string') {
|
53
60
|
error.push(stylize((ctx.line - 1) + ' ' + extract[0], 'grey'));
|
54
61
|
}
|
55
62
|
|
56
|
-
if (extract[1]) {
|
57
|
-
|
58
|
-
|
59
|
-
|
63
|
+
if (typeof(extract[1]) === 'string') {
|
64
|
+
var errorTxt = ctx.line + ' ';
|
65
|
+
if (extract[1]) {
|
66
|
+
errorTxt += extract[1].slice(0, ctx.column) +
|
67
|
+
stylize(stylize(stylize(extract[1][ctx.column], 'bold') +
|
68
|
+
extract[1].slice(ctx.column + 1), 'red'), 'inverse');
|
69
|
+
}
|
70
|
+
error.push(errorTxt);
|
60
71
|
}
|
61
72
|
|
62
73
|
if (typeof(extract[2]) === 'string') {
|
63
74
|
error.push(stylize((ctx.line + 1) + ' ' + extract[2], 'grey'));
|
64
75
|
}
|
65
|
-
error = error.join('\n') + '\
|
76
|
+
error = error.join('\n') + stylize('', 'reset') + '\n';
|
66
77
|
|
67
78
|
message += stylize(ctx.type + 'Error: ' + ctx.message, 'red');
|
68
|
-
|
69
|
-
|
79
|
+
if (ctx.filename) {
|
80
|
+
message += stylize(' in ', 'red') + ctx.filename +
|
81
|
+
stylize(' on line ' + ctx.line + ', column ' + (ctx.column + 1) + ':', 'grey');
|
82
|
+
}
|
70
83
|
|
71
|
-
|
84
|
+
message += '\n' + error;
|
72
85
|
|
73
86
|
if (ctx.callLine) {
|
74
|
-
|
75
|
-
|
87
|
+
message += stylize('from ', 'red') + (ctx.filename || '') + '/n';
|
88
|
+
message += stylize(ctx.callLine, 'grey') + ' ' + ctx.callExtract + '/n';
|
76
89
|
}
|
90
|
+
|
91
|
+
return message;
|
92
|
+
},
|
93
|
+
writeError: function (ctx, options) {
|
94
|
+
options = options || {};
|
95
|
+
if (options.silent) { return; }
|
96
|
+
console.error(less.formatError(ctx, options));
|
77
97
|
}
|
78
98
|
};
|
79
99
|
|
80
|
-
|
81
|
-
|
82
|
-
|
83
|
-
|
84
|
-
|
85
|
-
|
86
|
-
|
87
|
-
|
88
|
-
|
89
|
-
|
90
|
-
|
91
|
-
|
92
|
-
|
93
|
-
|
94
|
-
|
95
|
-
|
96
|
-
|
97
|
-
|
98
|
-
|
99
|
-
|
100
|
-
|
101
|
-
|
102
|
-
|
103
|
-
|
104
|
-
|
100
|
+
require('./tree/color');
|
101
|
+
require('./tree/directive');
|
102
|
+
require('./tree/detached-ruleset');
|
103
|
+
require('./tree/operation');
|
104
|
+
require('./tree/dimension');
|
105
|
+
require('./tree/keyword');
|
106
|
+
require('./tree/variable');
|
107
|
+
require('./tree/ruleset');
|
108
|
+
require('./tree/element');
|
109
|
+
require('./tree/selector');
|
110
|
+
require('./tree/quoted');
|
111
|
+
require('./tree/expression');
|
112
|
+
require('./tree/rule');
|
113
|
+
require('./tree/call');
|
114
|
+
require('./tree/url');
|
115
|
+
require('./tree/alpha');
|
116
|
+
require('./tree/import');
|
117
|
+
require('./tree/mixin');
|
118
|
+
require('./tree/comment');
|
119
|
+
require('./tree/anonymous');
|
120
|
+
require('./tree/value');
|
121
|
+
require('./tree/javascript');
|
122
|
+
require('./tree/assignment');
|
123
|
+
require('./tree/condition');
|
124
|
+
require('./tree/paren');
|
125
|
+
require('./tree/media');
|
126
|
+
require('./tree/unicode-descriptor');
|
127
|
+
require('./tree/negative');
|
128
|
+
require('./tree/extend');
|
129
|
+
require('./tree/ruleset-call');
|
130
|
+
|
131
|
+
|
132
|
+
var isUrlRe = /^(?:https?:)?\/\//i;
|
133
|
+
|
134
|
+
less.Parser.fileLoader = function (file, currentFileInfo, callback, env) {
|
135
|
+
var pathname, dirname, data,
|
136
|
+
newFileInfo = {
|
137
|
+
relativeUrls: env.relativeUrls,
|
138
|
+
entryPath: currentFileInfo.entryPath,
|
139
|
+
rootpath: currentFileInfo.rootpath,
|
140
|
+
rootFilename: currentFileInfo.rootFilename
|
141
|
+
};
|
142
|
+
|
143
|
+
function handleDataAndCallCallback(data) {
|
144
|
+
var j = file.lastIndexOf('/');
|
145
|
+
|
146
|
+
// Pass on an updated rootpath if path of imported file is relative and file
|
147
|
+
// is in a (sub|sup) directory
|
148
|
+
//
|
149
|
+
// Examples:
|
150
|
+
// - If path of imported file is 'module/nav/nav.less' and rootpath is 'less/',
|
151
|
+
// then rootpath should become 'less/module/nav/'
|
152
|
+
// - If path of imported file is '../mixins.less' and rootpath is 'less/',
|
153
|
+
// then rootpath should become 'less/../'
|
154
|
+
if(newFileInfo.relativeUrls && !/^(?:[a-z-]+:|\/)/.test(file) && j != -1) {
|
155
|
+
var relativeSubDirectory = file.slice(0, j+1);
|
156
|
+
newFileInfo.rootpath = newFileInfo.rootpath + relativeSubDirectory; // append (sub|sup) directory path of imported file
|
105
157
|
}
|
106
|
-
|
158
|
+
newFileInfo.currentDirectory = pathname.replace(/[^\\\/]*$/, "");
|
159
|
+
newFileInfo.filename = pathname;
|
107
160
|
|
108
|
-
|
109
|
-
|
110
|
-
|
161
|
+
callback(null, data, pathname, newFileInfo);
|
162
|
+
}
|
163
|
+
|
164
|
+
var isUrl = isUrlRe.test( file );
|
165
|
+
if (isUrl || isUrlRe.test(currentFileInfo.currentDirectory)) {
|
166
|
+
if (request === undefined) {
|
167
|
+
try { request = require('request'); }
|
168
|
+
catch(e) { request = null; }
|
169
|
+
}
|
170
|
+
if (!request) {
|
171
|
+
callback({ type: 'File', message: "optional dependency 'request' required to import over http(s)\n" });
|
172
|
+
return;
|
173
|
+
}
|
111
174
|
|
112
|
-
|
113
|
-
|
114
|
-
|
115
|
-
|
116
|
-
|
117
|
-
|
175
|
+
var urlStr = isUrl ? file : url.resolve(currentFileInfo.currentDirectory, file),
|
176
|
+
urlObj = url.parse(urlStr);
|
177
|
+
|
178
|
+
request.get({uri: urlStr, strictSSL: !env.insecure }, function (error, res, body) {
|
179
|
+
if (res.statusCode === 404) {
|
180
|
+
callback({ type: 'File', message: "resource '" + urlStr + "' was not found\n" });
|
181
|
+
return;
|
182
|
+
}
|
183
|
+
if (!body) {
|
184
|
+
console.error( 'Warning: Empty body (HTTP '+ res.statusCode + ') returned by "' + urlStr +'"' );
|
185
|
+
}
|
186
|
+
if (error) {
|
187
|
+
callback({ type: 'File', message: "resource '" + urlStr + "' gave this Error:\n "+ error +"\n" });
|
188
|
+
}
|
189
|
+
pathname = urlStr;
|
190
|
+
dirname = urlObj.protocol +'//'+ urlObj.host + urlObj.pathname.replace(/[^\/]*$/, '');
|
191
|
+
handleDataAndCallCallback(body);
|
118
192
|
});
|
119
193
|
} else {
|
120
|
-
|
121
|
-
|
194
|
+
|
195
|
+
var paths = [currentFileInfo.currentDirectory].concat(env.paths);
|
196
|
+
paths.push('.');
|
197
|
+
|
198
|
+
if (env.syncImport) {
|
199
|
+
for (var i = 0; i < paths.length; i++) {
|
200
|
+
try {
|
201
|
+
pathname = path.join(paths[i], file);
|
202
|
+
fs.statSync(pathname);
|
203
|
+
break;
|
204
|
+
} catch (e) {
|
205
|
+
pathname = null;
|
206
|
+
}
|
207
|
+
}
|
208
|
+
|
209
|
+
if (!pathname) {
|
210
|
+
callback({ type: 'File', message: "'" + file + "' wasn't found" });
|
211
|
+
return;
|
212
|
+
}
|
213
|
+
|
214
|
+
try {
|
215
|
+
data = fs.readFileSync(pathname, 'utf-8');
|
216
|
+
handleDataAndCallCallback(data);
|
217
|
+
} catch (e) {
|
218
|
+
callback(e);
|
219
|
+
}
|
122
220
|
} else {
|
123
|
-
|
221
|
+
(function tryPathIndex(i) {
|
222
|
+
if (i < paths.length) {
|
223
|
+
pathname = path.join(paths[i], file);
|
224
|
+
fs.stat(pathname, function (err) {
|
225
|
+
if (err) {
|
226
|
+
tryPathIndex(i + 1);
|
227
|
+
} else {
|
228
|
+
fs.readFile(pathname, 'utf-8', function(e, data) {
|
229
|
+
if (e) { callback(e); }
|
230
|
+
handleDataAndCallCallback(data);
|
231
|
+
});
|
232
|
+
}
|
233
|
+
});
|
234
|
+
} else {
|
235
|
+
callback({ type: 'File', message: "'" + file + "' wasn't found" });
|
236
|
+
}
|
237
|
+
}(0));
|
124
238
|
}
|
125
239
|
}
|
126
|
-
}
|
240
|
+
};
|
127
241
|
|
242
|
+
require('./env');
|
128
243
|
require('./functions');
|
129
244
|
require('./colors');
|
130
|
-
|
131
|
-
|
132
|
-
|
133
|
-
|
134
|
-
|
135
|
-
|
136
|
-
|
137
|
-
|
138
|
-
'underline' : [4, 24],
|
139
|
-
'yellow' : [33, 39],
|
140
|
-
'green' : [32, 39],
|
141
|
-
'red' : [31, 39],
|
142
|
-
'grey' : [90, 39]
|
143
|
-
};
|
144
|
-
return '\033[' + styles[style][0] + 'm' + str +
|
145
|
-
'\033[' + styles[style][1] + 'm';
|
146
|
-
}
|
147
|
-
less.stylize = stylize;
|
148
|
-
|
245
|
+
require('./visitor.js');
|
246
|
+
require('./import-visitor.js');
|
247
|
+
require('./extend-visitor.js');
|
248
|
+
require('./join-selector-visitor.js');
|
249
|
+
require('./to-css-visitor.js');
|
250
|
+
require('./source-map-output.js');
|
251
|
+
|
252
|
+
for (var k in less) { if (less.hasOwnProperty(k)) { exports[k] = less[k]; }}
|
@@ -0,0 +1,44 @@
|
|
1
|
+
(function (tree) {
|
2
|
+
tree.joinSelectorVisitor = function() {
|
3
|
+
this.contexts = [[]];
|
4
|
+
this._visitor = new tree.visitor(this);
|
5
|
+
};
|
6
|
+
|
7
|
+
tree.joinSelectorVisitor.prototype = {
|
8
|
+
run: function (root) {
|
9
|
+
return this._visitor.visit(root);
|
10
|
+
},
|
11
|
+
visitRule: function (ruleNode, visitArgs) {
|
12
|
+
visitArgs.visitDeeper = false;
|
13
|
+
},
|
14
|
+
visitMixinDefinition: function (mixinDefinitionNode, visitArgs) {
|
15
|
+
visitArgs.visitDeeper = false;
|
16
|
+
},
|
17
|
+
|
18
|
+
visitRuleset: function (rulesetNode, visitArgs) {
|
19
|
+
var context = this.contexts[this.contexts.length - 1],
|
20
|
+
paths = [], selectors;
|
21
|
+
|
22
|
+
this.contexts.push(paths);
|
23
|
+
|
24
|
+
if (! rulesetNode.root) {
|
25
|
+
selectors = rulesetNode.selectors;
|
26
|
+
if (selectors) {
|
27
|
+
selectors = selectors.filter(function(selector) { return selector.getIsOutput(); });
|
28
|
+
rulesetNode.selectors = selectors.length ? selectors : (selectors = null);
|
29
|
+
if (selectors) { rulesetNode.joinSelectors(paths, context, selectors); }
|
30
|
+
}
|
31
|
+
if (!selectors) { rulesetNode.rules = null; }
|
32
|
+
rulesetNode.paths = paths;
|
33
|
+
}
|
34
|
+
},
|
35
|
+
visitRulesetOut: function (rulesetNode) {
|
36
|
+
this.contexts.length = this.contexts.length - 1;
|
37
|
+
},
|
38
|
+
visitMedia: function (mediaNode, visitArgs) {
|
39
|
+
var context = this.contexts[this.contexts.length - 1];
|
40
|
+
mediaNode.rules[0].root = (context.length === 0 || context[0].multiMedia);
|
41
|
+
}
|
42
|
+
};
|
43
|
+
|
44
|
+
})(require('./tree'));
|
@@ -0,0 +1,82 @@
|
|
1
|
+
// lessc_helper.js
|
2
|
+
//
|
3
|
+
// helper functions for lessc
|
4
|
+
var lessc_helper = {
|
5
|
+
|
6
|
+
//Stylize a string
|
7
|
+
stylize : function(str, style) {
|
8
|
+
var styles = {
|
9
|
+
'reset' : [0, 0],
|
10
|
+
'bold' : [1, 22],
|
11
|
+
'inverse' : [7, 27],
|
12
|
+
'underline' : [4, 24],
|
13
|
+
'yellow' : [33, 39],
|
14
|
+
'green' : [32, 39],
|
15
|
+
'red' : [31, 39],
|
16
|
+
'grey' : [90, 39]
|
17
|
+
};
|
18
|
+
return '\033[' + styles[style][0] + 'm' + str +
|
19
|
+
'\033[' + styles[style][1] + 'm';
|
20
|
+
},
|
21
|
+
|
22
|
+
//Print command line options
|
23
|
+
printUsage: function() {
|
24
|
+
console.log("usage: lessc [option option=parameter ...] <source> [destination]");
|
25
|
+
console.log("");
|
26
|
+
console.log("If source is set to `-' (dash or hyphen-minus), input is read from stdin.");
|
27
|
+
console.log("");
|
28
|
+
console.log("options:");
|
29
|
+
console.log(" -h, --help Print help (this message) and exit.");
|
30
|
+
console.log(" --include-path=PATHS Set include paths. Separated by `:'. Use `;' on Windows.");
|
31
|
+
console.log(" -M, --depends Output a makefile import dependency list to stdout");
|
32
|
+
console.log(" --no-color Disable colorized output.");
|
33
|
+
console.log(" --no-ie-compat Disable IE compatibility checks.");
|
34
|
+
console.log(" --no-js Disable JavaScript in less files");
|
35
|
+
console.log(" -l, --lint Syntax check only (lint).");
|
36
|
+
console.log(" -s, --silent Suppress output of error messages.");
|
37
|
+
console.log(" --strict-imports Force evaluation of imports.");
|
38
|
+
console.log(" --insecure Allow imports from insecure https hosts.");
|
39
|
+
console.log(" -v, --version Print version number and exit.");
|
40
|
+
console.log(" -x, --compress Compress output by removing some whitespaces.");
|
41
|
+
console.log(" --clean-css Compress output using clean-css");
|
42
|
+
console.log(" --clean-option=opt:val Pass an option to clean css, using CLI arguments from ");
|
43
|
+
console.log(" https://github.com/GoalSmashers/clean-css e.g.");
|
44
|
+
console.log(" --clean-option=--selectors-merge-mode:ie8");
|
45
|
+
console.log(" and to switch on advanced use --clean-option=--advanced");
|
46
|
+
console.log(" --source-map[=FILENAME] Outputs a v3 sourcemap to the filename (or output filename.map)");
|
47
|
+
console.log(" --source-map-rootpath=X adds this path onto the sourcemap filename and less file paths");
|
48
|
+
console.log(" --source-map-basepath=X Sets sourcemap base path, defaults to current working directory.");
|
49
|
+
console.log(" --source-map-less-inline puts the less files into the map instead of referencing them");
|
50
|
+
console.log(" --source-map-map-inline puts the map (and any less files) into the output css file");
|
51
|
+
console.log(" --source-map-url=URL the complete url and filename put in the less file");
|
52
|
+
console.log(" -rp, --rootpath=URL Set rootpath for url rewriting in relative imports and urls.");
|
53
|
+
console.log(" Works with or without the relative-urls option.");
|
54
|
+
console.log(" -ru, --relative-urls re-write relative urls to the base less file.");
|
55
|
+
console.log(" -sm=on|off Turn on or off strict math, where in strict mode, math");
|
56
|
+
console.log(" --strict-math=on|off requires brackets. This option may default to on and then");
|
57
|
+
console.log(" be removed in the future.");
|
58
|
+
console.log(" -su=on|off Allow mixed units, e.g. 1px+1em or 1px*1px which have units");
|
59
|
+
console.log(" --strict-units=on|off that cannot be represented.");
|
60
|
+
console.log(" --global-var='VAR=VALUE' Defines a variable that can be referenced by the file.");
|
61
|
+
console.log(" --modify-var='VAR=VALUE' Modifies a variable already declared in the file.");
|
62
|
+
console.log("");
|
63
|
+
console.log("-------------------------- Deprecated ----------------");
|
64
|
+
console.log(" -O0, -O1, -O2 Set the parser's optimization level. The lower");
|
65
|
+
console.log(" the number, the less nodes it will create in the");
|
66
|
+
console.log(" tree. This could matter for debugging, or if you");
|
67
|
+
console.log(" want to access the individual nodes in the tree.");
|
68
|
+
console.log(" --line-numbers=TYPE Outputs filename and line numbers.");
|
69
|
+
console.log(" TYPE can be either 'comments', which will output");
|
70
|
+
console.log(" the debug info within comments, 'mediaquery'");
|
71
|
+
console.log(" that will output the information within a fake");
|
72
|
+
console.log(" media query which is compatible with the SASS");
|
73
|
+
console.log(" format, and 'all' which will do both.");
|
74
|
+
console.log(" --verbose Be verbose.");
|
75
|
+
console.log("");
|
76
|
+
console.log("Report bugs to: http://github.com/less/less.js/issues");
|
77
|
+
console.log("Home page: <http://lesscss.org/>");
|
78
|
+
}
|
79
|
+
};
|
80
|
+
|
81
|
+
// Exports helper functions
|
82
|
+
for (var h in lessc_helper) { if (lessc_helper.hasOwnProperty(h)) { exports[h] = lessc_helper[h]; }}
|