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,162 @@
|
|
1
|
+
###
|
2
|
+
# NOTICE:
|
3
|
+
# this file is specifically for controlling
|
4
|
+
# paths for Less.js source files, as well as
|
5
|
+
# the order in which source files are
|
6
|
+
# concatenated.
|
7
|
+
#
|
8
|
+
# Please do not add paths for anything else
|
9
|
+
# to this file. All other paths for testing,
|
10
|
+
# benchmarking and so on should be controlled
|
11
|
+
# in the Gruntfile.
|
12
|
+
###
|
13
|
+
|
14
|
+
# Less.js Lib
|
15
|
+
lib: lib/less
|
16
|
+
lib_source_map: 'lib/source-map'
|
17
|
+
|
18
|
+
# =================================
|
19
|
+
# General
|
20
|
+
# =================================
|
21
|
+
prepend:
|
22
|
+
browser: ['build/require.js', 'build/browser-header.js']
|
23
|
+
rhino: ['build/require-rhino.js', 'build/rhino-header.js', 'build/rhino-modules.js']
|
24
|
+
|
25
|
+
append:
|
26
|
+
amd: build/amd.js
|
27
|
+
browser: <%= build.lib %>/browser.js
|
28
|
+
rhino: <%= build.lib %>/rhino.js
|
29
|
+
|
30
|
+
|
31
|
+
# =================================
|
32
|
+
# Core less files
|
33
|
+
# =================================
|
34
|
+
|
35
|
+
# <%= build.less.* %>
|
36
|
+
less:
|
37
|
+
parser : <%= build.lib %>/parser.js
|
38
|
+
functions : <%= build.lib %>/functions.js
|
39
|
+
colors : <%= build.lib %>/colors.js
|
40
|
+
tree : <%= build.lib %>/tree.js
|
41
|
+
treedir : <%= build.lib %>/tree/*.js # glob all files in ./lib/less/tree directory
|
42
|
+
env : <%= build.lib %>/env.js
|
43
|
+
visitor : <%= build.lib %>/visitor.js
|
44
|
+
import_visitor : <%= build.lib %>/import-visitor.js
|
45
|
+
join : <%= build.lib %>/join-selector-visitor.js
|
46
|
+
to_css_visitor : <%= build.lib %>/to-css-visitor.js
|
47
|
+
extend_visitor : <%= build.lib %>/extend-visitor.js
|
48
|
+
browser : <%= build.lib %>/browser.js
|
49
|
+
source_map_output: <%= build.lib %>/source-map-output.js
|
50
|
+
|
51
|
+
|
52
|
+
# =================================
|
53
|
+
# Browser build
|
54
|
+
# =================================
|
55
|
+
|
56
|
+
# <%= build.browser %>
|
57
|
+
browser:
|
58
|
+
|
59
|
+
# prepend utils
|
60
|
+
- <%= build.prepend.browser %>
|
61
|
+
|
62
|
+
# core
|
63
|
+
- <%= build.less.parser %>
|
64
|
+
- <%= build.less.functions %>
|
65
|
+
- <%= build.less.colors %>
|
66
|
+
- <%= build.less.tree %>
|
67
|
+
- <%= build.less.treedir %> # glob all files
|
68
|
+
- <%= build.less.env %>
|
69
|
+
- <%= build.less.visitor %>
|
70
|
+
- <%= build.less.import_visitor %>
|
71
|
+
- <%= build.less.join %>
|
72
|
+
- <%= build.less.to_css_visitor %>
|
73
|
+
- <%= build.less.extend_visitor %>
|
74
|
+
- <%= build.less.source_map_output %>
|
75
|
+
|
76
|
+
# append browser-specific code
|
77
|
+
- <%= build.append.browser %>
|
78
|
+
- <%= build.append.amd %>
|
79
|
+
|
80
|
+
|
81
|
+
# =================================
|
82
|
+
# Rhino build
|
83
|
+
# =================================
|
84
|
+
|
85
|
+
# <%= build.rhino %>
|
86
|
+
rhino:
|
87
|
+
# prepend utils
|
88
|
+
- <%= build.prepend.rhino %>
|
89
|
+
|
90
|
+
# core
|
91
|
+
- <%= build.less.parser %>
|
92
|
+
- <%= build.less.functions %>
|
93
|
+
- <%= build.less.colors %>
|
94
|
+
- <%= build.less.tree %>
|
95
|
+
- <%= build.less.treedir %> # glob all files
|
96
|
+
- <%= build.less.env %>
|
97
|
+
- <%= build.less.visitor %>
|
98
|
+
- <%= build.less.import_visitor %>
|
99
|
+
- <%= build.less.join %>
|
100
|
+
- <%= build.less.to_css_visitor %>
|
101
|
+
- <%= build.less.extend_visitor %>
|
102
|
+
- <%= build.less.source_map_output %>
|
103
|
+
- <%= build.source_map %>
|
104
|
+
|
105
|
+
|
106
|
+
# <%= build.rhinolessc %>
|
107
|
+
rhinolessc:
|
108
|
+
- <%= build.append.rhino %>
|
109
|
+
|
110
|
+
|
111
|
+
# =================================
|
112
|
+
# Tree files
|
113
|
+
# =================================
|
114
|
+
|
115
|
+
# <%= build.tree %>
|
116
|
+
# Technically listing the array out this way isn't
|
117
|
+
# necessary since we can glob the files in alphabetical
|
118
|
+
# order anyway. But this gives you control over the order
|
119
|
+
# the files are used, and allows targeting of individual
|
120
|
+
# files directly in the Gruntfile. But be we can just
|
121
|
+
# remove this if files can be concatenated in any order.
|
122
|
+
tree:
|
123
|
+
- <%= build.lib %>/tree/alpha.js
|
124
|
+
- <%= build.lib %>/tree/anonymous.js
|
125
|
+
- <%= build.lib %>/tree/assignment.js
|
126
|
+
- <%= build.lib %>/tree/call.js
|
127
|
+
- <%= build.lib %>/tree/color.js
|
128
|
+
- <%= build.lib %>/tree/comment.js
|
129
|
+
- <%= build.lib %>/tree/condition.js
|
130
|
+
- <%= build.lib %>/tree/detached-ruleset.js
|
131
|
+
- <%= build.lib %>/tree/dimension.js
|
132
|
+
- <%= build.lib %>/tree/directive.js
|
133
|
+
- <%= build.lib %>/tree/element.js
|
134
|
+
- <%= build.lib %>/tree/expression.js
|
135
|
+
- <%= build.lib %>/tree/extend.js
|
136
|
+
- <%= build.lib %>/tree/import.js
|
137
|
+
- <%= build.lib %>/tree/javascript.js
|
138
|
+
- <%= build.lib %>/tree/keyword.js
|
139
|
+
- <%= build.lib %>/tree/media.js
|
140
|
+
- <%= build.lib %>/tree/mixin.js
|
141
|
+
- <%= build.lib %>/tree/negative.js
|
142
|
+
- <%= build.lib %>/tree/operation.js
|
143
|
+
- <%= build.lib %>/tree/paren.js
|
144
|
+
- <%= build.lib %>/tree/quoted.js
|
145
|
+
- <%= build.lib %>/tree/rule.js
|
146
|
+
- <%= build.lib %>/tree/ruleset.js
|
147
|
+
- <%= build.lib %>/tree/ruleset-call.js
|
148
|
+
- <%= build.lib %>/tree/selector.js
|
149
|
+
- <%= build.lib %>/tree/unicode-descriptor.js
|
150
|
+
- <%= build.lib %>/tree/url.js
|
151
|
+
- <%= build.lib %>/tree/value.js
|
152
|
+
- <%= build.lib %>/tree/variable.js
|
153
|
+
|
154
|
+
# =================================
|
155
|
+
# source-map build
|
156
|
+
# =================================
|
157
|
+
|
158
|
+
# <%= build.source_map %>
|
159
|
+
source_map:
|
160
|
+
- <%= build.lib_source_map %>/source-map-header.js
|
161
|
+
- <%= build.lib_source_map %>/source-map-0.1.31.js
|
162
|
+
- <%= build.lib_source_map %>/source-map-footer.js
|
@@ -2,6 +2,11 @@
|
|
2
2
|
// Stub out `require` in rhino
|
3
3
|
//
|
4
4
|
function require(arg) {
|
5
|
-
|
6
|
-
|
5
|
+
var split = arg.split('/');
|
6
|
+
var resultModule = split.length == 1 ? less.modules[split[0]] : less[split[1]];
|
7
|
+
if (!resultModule) {
|
8
|
+
throw { message: "Cannot find module '" + arg + "'"};
|
9
|
+
}
|
10
|
+
return resultModule;
|
11
|
+
}
|
7
12
|
|
@@ -0,0 +1,131 @@
|
|
1
|
+
(function() {
|
2
|
+
|
3
|
+
console = function() {
|
4
|
+
var stdout = java.lang.System.out;
|
5
|
+
var stderr = java.lang.System.err;
|
6
|
+
|
7
|
+
function doLog(out, type) {
|
8
|
+
return function() {
|
9
|
+
var args = java.lang.reflect.Array.newInstance(java.lang.Object, arguments.length - 1);
|
10
|
+
var format = arguments[0];
|
11
|
+
var conversionIndex = 0;
|
12
|
+
// need to look for %d (integer) conversions because in Javascript all numbers are doubles
|
13
|
+
for (var i = 1; i < arguments.length; i++) {
|
14
|
+
var arg = arguments[i];
|
15
|
+
if (conversionIndex != -1) {
|
16
|
+
conversionIndex = format.indexOf('%', conversionIndex);
|
17
|
+
}
|
18
|
+
if (conversionIndex >= 0 && conversionIndex < format.length) {
|
19
|
+
var conversion = format.charAt(conversionIndex + 1);
|
20
|
+
if (conversion === 'd' && typeof arg === 'number') {
|
21
|
+
arg = new java.lang.Integer(new java.lang.Double(arg).intValue());
|
22
|
+
}
|
23
|
+
conversionIndex++;
|
24
|
+
}
|
25
|
+
args[i-1] = arg;
|
26
|
+
}
|
27
|
+
try {
|
28
|
+
out.println(type + java.lang.String.format(format, args));
|
29
|
+
} catch(ex) {
|
30
|
+
stderr.println(ex);
|
31
|
+
}
|
32
|
+
}
|
33
|
+
}
|
34
|
+
return {
|
35
|
+
log: doLog(stdout, ''),
|
36
|
+
info: doLog(stdout, 'INFO: '),
|
37
|
+
error: doLog(stderr, 'ERROR: '),
|
38
|
+
warn: doLog(stderr, 'WARN: ')
|
39
|
+
};
|
40
|
+
}();
|
41
|
+
|
42
|
+
less.modules = {};
|
43
|
+
|
44
|
+
less.modules.path = {
|
45
|
+
join: function() {
|
46
|
+
var parts = [];
|
47
|
+
for (i in arguments) {
|
48
|
+
parts = parts.concat(arguments[i].split(/\/|\\/));
|
49
|
+
}
|
50
|
+
var result = [];
|
51
|
+
for (i in parts) {
|
52
|
+
var part = parts[i];
|
53
|
+
if (part === '..' && result.length > 0) {
|
54
|
+
result.pop();
|
55
|
+
} else if (part === '' && result.length > 0) {
|
56
|
+
// skip
|
57
|
+
} else if (part !== '.') {
|
58
|
+
if (part.slice(-1)==='\\' || part.slice(-1)==='/') {
|
59
|
+
part = part.slice(0, -1);
|
60
|
+
}
|
61
|
+
result.push(part);
|
62
|
+
}
|
63
|
+
}
|
64
|
+
return result.join('/');
|
65
|
+
},
|
66
|
+
dirname: function(p) {
|
67
|
+
var path = p.split('/');
|
68
|
+
path.pop();
|
69
|
+
return path.join('/');
|
70
|
+
},
|
71
|
+
basename: function(p, ext) {
|
72
|
+
var base = p.split('/').pop();
|
73
|
+
if (ext) {
|
74
|
+
var index = base.lastIndexOf(ext);
|
75
|
+
if (base.length === index + ext.length) {
|
76
|
+
base = base.substr(0, index);
|
77
|
+
}
|
78
|
+
}
|
79
|
+
return base;
|
80
|
+
},
|
81
|
+
extname: function(p) {
|
82
|
+
var index = p.lastIndexOf('.');
|
83
|
+
return index > 0 ? p.substring(index) : '';
|
84
|
+
}
|
85
|
+
};
|
86
|
+
|
87
|
+
less.modules.fs = {
|
88
|
+
readFileSync: function(name) {
|
89
|
+
// read a file into a byte array
|
90
|
+
var file = new java.io.File(name);
|
91
|
+
var stream = new java.io.FileInputStream(file);
|
92
|
+
var buffer = [];
|
93
|
+
var c;
|
94
|
+
while ((c = stream.read()) != -1) {
|
95
|
+
buffer.push(c);
|
96
|
+
}
|
97
|
+
stream.close();
|
98
|
+
return {
|
99
|
+
length: buffer.length,
|
100
|
+
toString: function(enc) {
|
101
|
+
if (enc === 'base64') {
|
102
|
+
return encodeBase64Bytes(buffer);
|
103
|
+
} else if (enc) {
|
104
|
+
return java.lang.String["(byte[],java.lang.String)"](buffer, enc);
|
105
|
+
} else {
|
106
|
+
return java.lang.String["(byte[])"](buffer);
|
107
|
+
}
|
108
|
+
}
|
109
|
+
};
|
110
|
+
}
|
111
|
+
};
|
112
|
+
|
113
|
+
less.encoder = {
|
114
|
+
encodeBase64: function(str) {
|
115
|
+
return encodeBase64String(str);
|
116
|
+
}
|
117
|
+
};
|
118
|
+
|
119
|
+
// ---------------------------------------------------------------------------------------------
|
120
|
+
// private helper functions
|
121
|
+
// ---------------------------------------------------------------------------------------------
|
122
|
+
|
123
|
+
function encodeBase64Bytes(bytes) {
|
124
|
+
// requires at least a JRE Platform 6 (or JAXB 1.0 on the classpath)
|
125
|
+
return javax.xml.bind.DatatypeConverter.printBase64Binary(bytes)
|
126
|
+
}
|
127
|
+
function encodeBase64String(str) {
|
128
|
+
return encodeBase64Bytes(new java.lang.String(str).getBytes());
|
129
|
+
}
|
130
|
+
|
131
|
+
})();
|
@@ -0,0 +1 @@
|
|
1
|
+
# Reserved for specialized Less.js tasks.
|
@@ -0,0 +1,347 @@
|
|
1
|
+
import groovy.io.FileType
|
2
|
+
import org.apache.tools.ant.taskdefs.condition.Os
|
3
|
+
import org.gradle.api.tasks.Exec
|
4
|
+
|
5
|
+
buildscript {
|
6
|
+
repositories {
|
7
|
+
mavenCentral()
|
8
|
+
jcenter()
|
9
|
+
}
|
10
|
+
dependencies {
|
11
|
+
classpath 'com.eriwen:gradle-js-plugin:1.8.0'
|
12
|
+
classpath 'com.moowork.gradle:gradle-grunt-plugin:0.2'
|
13
|
+
}
|
14
|
+
}
|
15
|
+
|
16
|
+
apply plugin: 'js'
|
17
|
+
apply plugin: 'grunt'
|
18
|
+
|
19
|
+
repositories {
|
20
|
+
mavenCentral()
|
21
|
+
}
|
22
|
+
|
23
|
+
configurations {
|
24
|
+
rhino
|
25
|
+
}
|
26
|
+
|
27
|
+
dependencies {
|
28
|
+
rhino 'org.mozilla:rhino:1.7R4'
|
29
|
+
}
|
30
|
+
|
31
|
+
project.ext {
|
32
|
+
packageProps = new groovy.json.JsonSlurper().parseText(new File("package.json").toURL().text)
|
33
|
+
failures = 0;
|
34
|
+
rhinoTestSrc = "out/rhino-test-${packageProps.version}.js"
|
35
|
+
testSrc = 'test/less'
|
36
|
+
testOut = 'out/test'
|
37
|
+
}
|
38
|
+
|
39
|
+
task runGruntRhino(type: GruntTask) {
|
40
|
+
gruntArgs = "rhino"
|
41
|
+
}
|
42
|
+
|
43
|
+
combineJs {
|
44
|
+
dependsOn runGruntRhino
|
45
|
+
source = ["dist/less-rhino-${packageProps.version}.js", "test/rhino/test-header.js","dist/lessc-rhino-${packageProps.version}.js"]
|
46
|
+
dest = file(rhinoTestSrc)
|
47
|
+
}
|
48
|
+
|
49
|
+
task testRhino(type: AllRhinoTests) {
|
50
|
+
// dependsOn 'testRhinoBase'
|
51
|
+
dependsOn 'testRhinoBase', 'testRhinoErrors', 'testRhinoLegacy', 'testRhinoStaticUrls', 'testRhinoCompression', 'testRhinoDebugAll', 'testRhinoDebugComments', 'testRhinoDebugMediaquery', 'testRhinoNoJsError', 'testRhinoSourceMap'
|
52
|
+
}
|
53
|
+
|
54
|
+
task testRhinoBase(type: RhinoTest) {
|
55
|
+
options = [ '--strict-math=true', '--relative-urls' ]
|
56
|
+
}
|
57
|
+
|
58
|
+
task testRhinoDebugAll(type: DebugRhinoTest) {
|
59
|
+
options = [ '--strict-math=true', '--line-numbers=all' ]
|
60
|
+
testDir = 'debug' + fs
|
61
|
+
suffix = "-all"
|
62
|
+
}
|
63
|
+
|
64
|
+
task testRhinoDebugComments(type: DebugRhinoTest) {
|
65
|
+
options = [ '--strict-math=true', '--line-numbers=comments' ]
|
66
|
+
testDir = 'debug' + fs
|
67
|
+
suffix = "-comments"
|
68
|
+
}
|
69
|
+
|
70
|
+
task testRhinoDebugMediaquery(type: DebugRhinoTest) {
|
71
|
+
options = [ '--strict-math=true', '--line-numbers=mediaquery' ]
|
72
|
+
testDir = 'debug' + fs
|
73
|
+
suffix = "-mediaquery"
|
74
|
+
}
|
75
|
+
|
76
|
+
task testRhinoErrors(type: RhinoTest) {
|
77
|
+
options = [ '--strict-math=true', '--strict-units=true' ]
|
78
|
+
testDir = 'errors/'
|
79
|
+
expectErrors = true
|
80
|
+
}
|
81
|
+
|
82
|
+
task testRhinoChyby(type: RhinoTest) {
|
83
|
+
options = [ '--strict-math=true', '--strict-units=true' ]
|
84
|
+
testDir = 'chyby/'
|
85
|
+
// expectErrors = true
|
86
|
+
}
|
87
|
+
|
88
|
+
task testRhinoNoJsError(type: RhinoTest) {
|
89
|
+
options = [ '--strict-math=true', '--strict-units=true', '--no-js' ]
|
90
|
+
testDir = 'no-js-errors/'
|
91
|
+
expectErrors = true
|
92
|
+
}
|
93
|
+
|
94
|
+
task testRhinoLegacy(type: RhinoTest) {
|
95
|
+
testDir = 'legacy/'
|
96
|
+
}
|
97
|
+
|
98
|
+
task testRhinoStaticUrls(type: RhinoTest) {
|
99
|
+
options = [ '--strict-math=true', '--rootpath=folder (1)/' ]
|
100
|
+
testDir = 'static-urls/'
|
101
|
+
}
|
102
|
+
|
103
|
+
task testRhinoCompression(type: RhinoTest) {
|
104
|
+
options = [ '--compress=true' ]
|
105
|
+
testDir = 'compression/'
|
106
|
+
}
|
107
|
+
|
108
|
+
task testRhinoSourceMap(type: SourceMapRhinoTest) {
|
109
|
+
options = [ '--strict-math=true', '--strict-units=true']
|
110
|
+
testDir = 'sourcemaps/'
|
111
|
+
}
|
112
|
+
|
113
|
+
task setupTest {
|
114
|
+
dependsOn combineJs
|
115
|
+
doLast {
|
116
|
+
file(testOut).deleteDir()
|
117
|
+
}
|
118
|
+
}
|
119
|
+
|
120
|
+
task clean << {
|
121
|
+
file(rhinoTestSrc).delete()
|
122
|
+
file(testOut).deleteDir()
|
123
|
+
}
|
124
|
+
|
125
|
+
class SourceMapRhinoTest extends RhinoTest {
|
126
|
+
|
127
|
+
// helper to get the output map file
|
128
|
+
def getOutputMap(lessFile) {
|
129
|
+
def outFile = project.file(lessFile.path.replace('test/less', project.testOut).replace('.less', '.css'))
|
130
|
+
return project.file(outFile.path + ".map");
|
131
|
+
}
|
132
|
+
|
133
|
+
// callback to add SourceMap options to the options list
|
134
|
+
def postProcessOptions(options, lessFile) {
|
135
|
+
def outFile = getOutputMap(lessFile)
|
136
|
+
project.file(outFile.parent).mkdirs()
|
137
|
+
options << "--source-map=${testDir}${lessFile.name.replace('.less','.css')}"
|
138
|
+
options << "--source-map-basepath=${lessRootDir}"
|
139
|
+
options << "--source-map-rootpath=testweb/"
|
140
|
+
options << "--source-map-output-map-file=${outFile}"
|
141
|
+
|
142
|
+
options
|
143
|
+
}
|
144
|
+
|
145
|
+
// Callback to validate output
|
146
|
+
def handleResult(exec, out, lessFile) {
|
147
|
+
def actualFile = getOutputMap(lessFile)
|
148
|
+
def expectedFile = project.file(projectDir + fs + "test" + fs + testDir + fs + lessFile.name.replace(".less", ".json"))
|
149
|
+
assert actualFile.text == expectedFile.text
|
150
|
+
}
|
151
|
+
|
152
|
+
}
|
153
|
+
|
154
|
+
class DebugRhinoTest extends RhinoTest {
|
155
|
+
|
156
|
+
def escapeIt(it) {
|
157
|
+
return it.replaceAll("\\\\", "\\\\\\\\").replaceAll("/", "\\\\/").replaceAll(":", "\\\\:").replaceAll("\\.", "\\\\.");
|
158
|
+
}
|
159
|
+
|
160
|
+
def globalReplacements(input, directory) {
|
161
|
+
def pDirectory = toPlatformFs(directory)
|
162
|
+
def p = lessRootDir + fs + pDirectory
|
163
|
+
def pathimport = p + toPlatformFs("import/")
|
164
|
+
def pathesc = escapeIt(p)
|
165
|
+
def pathimportesc = escapeIt(pathimport)
|
166
|
+
|
167
|
+
def result = input.replace("{path}", p).replace("{pathesc}", pathesc).replace("{pathimport}", pathimport)
|
168
|
+
return result.replace("{pathimportesc}", pathimportesc).replace("\r\n", "\n")
|
169
|
+
}
|
170
|
+
}
|
171
|
+
|
172
|
+
class RhinoTest extends DefaultTask {
|
173
|
+
|
174
|
+
RhinoTest() {
|
175
|
+
dependsOn 'setupTest'
|
176
|
+
}
|
177
|
+
|
178
|
+
def suffix = ""
|
179
|
+
def testDir = ''
|
180
|
+
def options = []
|
181
|
+
def expectErrors = false
|
182
|
+
def fs = File.separator;
|
183
|
+
def projectDir = toUpperCaseDriveLetter(System.getProperty("user.dir"));
|
184
|
+
def lessRootDir = projectDir + fs + "test" + fs + "less"
|
185
|
+
|
186
|
+
def toUpperCaseDriveLetter(path) {
|
187
|
+
if (path.charAt(1)==':' && path.charAt(2)=='\\') {
|
188
|
+
return path.substring(0,1).toUpperCase() + path.substring(1);
|
189
|
+
}
|
190
|
+
return path;
|
191
|
+
}
|
192
|
+
|
193
|
+
def toPlatformFs(path) {
|
194
|
+
return path.replace('\\', fs).replace('/', fs);
|
195
|
+
}
|
196
|
+
|
197
|
+
def expectedCssPath(lessFilePath) {
|
198
|
+
lessFilePath.replace('.less', "${suffix}.css").replace("${fs}less${fs}", "${fs}css${fs}");
|
199
|
+
}
|
200
|
+
|
201
|
+
def globalReplacements(input, directory) {
|
202
|
+
return input;
|
203
|
+
}
|
204
|
+
|
205
|
+
def stylize(str, style) {
|
206
|
+
def styles = [
|
207
|
+
reset : [0, 0],
|
208
|
+
bold : [1, 22],
|
209
|
+
inverse : [7, 27],
|
210
|
+
underline : [4, 24],
|
211
|
+
yellow : [33, 39],
|
212
|
+
green : [32, 39],
|
213
|
+
red : [31, 39],
|
214
|
+
grey : [90, 39]
|
215
|
+
];
|
216
|
+
return '\033[' + styles[style][0] + 'm' + str +
|
217
|
+
'\033[' + styles[style][1] + 'm';
|
218
|
+
}
|
219
|
+
|
220
|
+
// Callback for subclasses to make any changes to the options
|
221
|
+
def postProcessOptions(options, lessFile) {
|
222
|
+
options
|
223
|
+
}
|
224
|
+
|
225
|
+
// Callback to validate output
|
226
|
+
def handleResult(exec, out, lessFile) {
|
227
|
+
def actual = out.toString().trim()
|
228
|
+
def actualResult = project.file(lessFile.path.replace('test/less', project.testOut).replace('.less', '.css'))
|
229
|
+
project.file(actualResult.parent).mkdirs()
|
230
|
+
actualResult << actual
|
231
|
+
def expected
|
232
|
+
if (expectErrors) {
|
233
|
+
assert exec.exitValue != 0
|
234
|
+
expected = project.file(lessFile.path.replace('.less', '.txt')).text.trim().
|
235
|
+
replace('{path}', lessFile.parent + '/').
|
236
|
+
replace('{pathhref}', '').
|
237
|
+
replace('{404status}', '')
|
238
|
+
} else {
|
239
|
+
assert exec.exitValue == 0
|
240
|
+
def expectedFile = expectedCssPath(lessFile.path)
|
241
|
+
expected = project.file(expectedFile).text.trim()
|
242
|
+
expected = globalReplacements(expected, testDir)
|
243
|
+
}
|
244
|
+
actual=actual.trim()
|
245
|
+
actual = actual.replace('\r\n', '\n')
|
246
|
+
expected = expected.replace('\r\n', '\n')
|
247
|
+
actual = actual.replace("/","\\")
|
248
|
+
expected = expected.replace("/","\\")
|
249
|
+
// println "* actual *"
|
250
|
+
// println actual
|
251
|
+
// new File("actual.txt").write(actual)
|
252
|
+
// println "* expected *"
|
253
|
+
// println expected
|
254
|
+
// new File("expected.txt").write(expected)
|
255
|
+
assert actual == expected
|
256
|
+
actualResult.delete()
|
257
|
+
|
258
|
+
}
|
259
|
+
|
260
|
+
@TaskAction
|
261
|
+
def runTest() {
|
262
|
+
int testSuccesses = 0, testFailures = 0, testErrors = 0
|
263
|
+
project.file('test/less/' + testDir).eachFileMatch(FileType.FILES, ~/.*\.less/) { lessFile ->
|
264
|
+
println "lessfile: $lessFile"
|
265
|
+
if (!project.hasProperty('test') || lessFile.name.startsWith(project.test)) {
|
266
|
+
def out = new java.io.ByteArrayOutputStream()
|
267
|
+
def processedOptions = postProcessOptions([project.rhinoTestSrc, lessFile] + options, lessFile)
|
268
|
+
def execOptions = {
|
269
|
+
main = 'org.mozilla.javascript.tools.shell.Main'
|
270
|
+
// main = 'org.mozilla.javascript.tools.debugger.Main'
|
271
|
+
classpath = project.configurations.rhino
|
272
|
+
args = processedOptions
|
273
|
+
standardOutput = out
|
274
|
+
ignoreExitValue = true
|
275
|
+
}
|
276
|
+
println "rhinoTestSrc: ${project.rhinoTestSrc}"
|
277
|
+
try {
|
278
|
+
def exec = project.javaexec(execOptions)
|
279
|
+
handleResult(exec, out, lessFile)
|
280
|
+
testSuccesses++
|
281
|
+
println stylize(' ok', 'green')
|
282
|
+
}
|
283
|
+
catch (ex) {
|
284
|
+
println ex
|
285
|
+
println()
|
286
|
+
testErrors++;
|
287
|
+
}
|
288
|
+
catch (AssertionError ae) {
|
289
|
+
println stylize(' failed', 'red')
|
290
|
+
println ae
|
291
|
+
testFailures++
|
292
|
+
}
|
293
|
+
} else {
|
294
|
+
println stylize(' skipped', 'yellow')
|
295
|
+
}
|
296
|
+
}
|
297
|
+
println stylize(testSuccesses + ' ok', 'green')
|
298
|
+
println stylize(testFailures + ' assertion failed', testFailures == 0 ? 'green' : 'red')
|
299
|
+
println stylize(testErrors + ' errors', testErrors == 0 ? 'green' : 'red')
|
300
|
+
if (testFailures != 0 || testErrors != 0) {
|
301
|
+
project.failures++;
|
302
|
+
}
|
303
|
+
}
|
304
|
+
}
|
305
|
+
|
306
|
+
class AllRhinoTests extends DefaultTask {
|
307
|
+
|
308
|
+
AllRhinoTests() {
|
309
|
+
}
|
310
|
+
|
311
|
+
@TaskAction
|
312
|
+
def runTest() {
|
313
|
+
println stylize(project.failures + ' test suites failed', project.failures == 0 ? 'green' : 'red')
|
314
|
+
}
|
315
|
+
|
316
|
+
def stylize(str, style) {
|
317
|
+
def styles = [
|
318
|
+
reset : [0, 0],
|
319
|
+
bold : [1, 22],
|
320
|
+
inverse : [7, 27],
|
321
|
+
underline : [4, 24],
|
322
|
+
yellow : [33, 39],
|
323
|
+
green : [32, 39],
|
324
|
+
red : [31, 39],
|
325
|
+
grey : [90, 39]
|
326
|
+
];
|
327
|
+
return '\033[' + styles[style][0] + 'm' + str +
|
328
|
+
'\033[' + styles[style][1] + 'm';
|
329
|
+
}
|
330
|
+
}
|
331
|
+
|
332
|
+
class GruntTask extends Exec {
|
333
|
+
private String gruntExecutable = Os.isFamily(Os.FAMILY_WINDOWS) ? "grunt.cmd" : "grunt"
|
334
|
+
private String switches = "--no-color"
|
335
|
+
|
336
|
+
String gruntArgs = ""
|
337
|
+
|
338
|
+
public GruntTask() {
|
339
|
+
super()
|
340
|
+
this.setExecutable(gruntExecutable)
|
341
|
+
}
|
342
|
+
|
343
|
+
public void setGruntArgs(String gruntArgs) {
|
344
|
+
this.args = "$switches $gruntArgs".trim().split(" ") as List
|
345
|
+
}
|
346
|
+
}
|
347
|
+
|