less-execjs 2.6.0.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.gitignore +7 -0
- data/.gitmodules +9 -0
- data/.rubocop.yml +8 -0
- data/.travis.yml +19 -0
- data/Gemfile +3 -0
- data/LICENSE +177 -0
- data/README.md +55 -0
- data/Rakefile +8 -0
- data/bin/lessc +22 -0
- data/less-execjs.gemspec +34 -0
- data/lib/less-execjs.rb +1 -0
- data/lib/less.rb +29 -0
- data/lib/less/compiler.js +24 -0
- data/lib/less/defaults.rb +15 -0
- data/lib/less/errors.rb +16 -0
- data/lib/less/js/image-size.js +4 -0
- data/lib/less/js/image-size/.gitignore +7 -0
- data/lib/less/js/image-size/.jshintrc +19 -0
- data/lib/less/js/image-size/.travis.yml +12 -0
- data/lib/less/js/image-size/Contributors.md +9 -0
- data/lib/less/js/image-size/LICENSE +9 -0
- data/lib/less/js/image-size/Readme.md +87 -0
- data/lib/less/js/image-size/bin/image-size.js +36 -0
- data/lib/less/js/image-size/lib/detector.js +19 -0
- data/lib/less/js/image-size/lib/index.js +104 -0
- data/lib/less/js/image-size/lib/readUInt.js +11 -0
- data/lib/less/js/image-size/lib/types.js +12 -0
- data/lib/less/js/image-size/lib/types/bmp.js +17 -0
- data/lib/less/js/image-size/lib/types/gif.js +19 -0
- data/lib/less/js/image-size/lib/types/jpg.js +62 -0
- data/lib/less/js/image-size/lib/types/png.js +23 -0
- data/lib/less/js/image-size/lib/types/psd.js +17 -0
- data/lib/less/js/image-size/lib/types/svg.js +78 -0
- data/lib/less/js/image-size/lib/types/tiff.js +118 -0
- data/lib/less/js/image-size/lib/types/webp.js +51 -0
- data/lib/less/js/image-size/package.json +49 -0
- data/lib/less/js/image-size/specs/.jshintrc +9 -0
- data/lib/less/js/image-size/specs/complexity.js +58 -0
- data/lib/less/js/image-size/specs/fs-close.spec.js +61 -0
- data/lib/less/js/image-size/specs/images/invalid/malformed.svg +1 -0
- data/lib/less/js/image-size/specs/images/invalid/sample.png +0 -0
- data/lib/less/js/image-size/specs/images/invalid/width.svg +1 -0
- data/lib/less/js/image-size/specs/images/valid/bmp/sample.bmp +0 -0
- data/lib/less/js/image-size/specs/images/valid/gif/sample.gif +0 -0
- data/lib/less/js/image-size/specs/images/valid/jpg/large.jpg +0 -0
- data/lib/less/js/image-size/specs/images/valid/jpg/progressive.jpg +0 -0
- data/lib/less/js/image-size/specs/images/valid/jpg/sample.jpg +0 -0
- data/lib/less/js/image-size/specs/images/valid/jpg/sampleExported.jpg +0 -0
- data/lib/less/js/image-size/specs/images/valid/jpg/very-large.jpg +0 -0
- data/lib/less/js/image-size/specs/images/valid/png/sample.png +0 -0
- data/lib/less/js/image-size/specs/images/valid/psd/sample.psd +0 -0
- data/lib/less/js/image-size/specs/images/valid/svg/percentage.svg +4 -0
- data/lib/less/js/image-size/specs/images/valid/svg/single-quotes.svg +5 -0
- data/lib/less/js/image-size/specs/images/valid/svg/viewbox-height.svg +4 -0
- data/lib/less/js/image-size/specs/images/valid/svg/viewbox-width-height.svg +4 -0
- data/lib/less/js/image-size/specs/images/valid/svg/viewbox-width.svg +4 -0
- data/lib/less/js/image-size/specs/images/valid/svg/viewbox.svg +4 -0
- data/lib/less/js/image-size/specs/images/valid/svg/width-height.svg +5 -0
- data/lib/less/js/image-size/specs/images/valid/tiff/big-endian.tiff +0 -0
- data/lib/less/js/image-size/specs/images/valid/tiff/jpeg.tiff +0 -0
- data/lib/less/js/image-size/specs/images/valid/tiff/little-endian.tiff +0 -0
- data/lib/less/js/image-size/specs/images/valid/webp/lossless.webp +0 -0
- data/lib/less/js/image-size/specs/images/valid/webp/lossy.webp +0 -0
- data/lib/less/js/image-size/specs/invalid.spec.js +53 -0
- data/lib/less/js/image-size/specs/others.spec.js +77 -0
- data/lib/less/js/image-size/specs/unsupported.spec.js +34 -0
- data/lib/less/js/image-size/specs/valid.spec.js +75 -0
- data/lib/less/js/less/.gitattributes +11 -0
- data/lib/less/js/less/.gitignore +27 -0
- data/lib/less/js/less/.jscsrc +73 -0
- data/lib/less/js/less/.jshintrc +11 -0
- data/lib/less/js/less/.npmignore +9 -0
- data/lib/less/js/less/.travis.yml +14 -0
- data/lib/less/js/less/CHANGELOG.md +561 -0
- data/lib/less/js/less/CONTRIBUTING.md +50 -0
- data/lib/less/js/less/Gruntfile.js +459 -0
- data/lib/less/js/less/LICENSE +177 -0
- data/lib/less/js/less/README.md +56 -0
- data/lib/less/js/less/appveyor.yml +32 -0
- data/lib/less/js/less/benchmark/benchmark.less +3979 -0
- data/lib/less/js/less/benchmark/index.js +55 -0
- data/lib/less/js/less/bin/lessc +488 -0
- data/lib/less/js/less/bower.json +24 -0
- data/lib/less/js/less/browser.js +1 -0
- data/lib/less/js/less/build.gradle +347 -0
- data/lib/less/js/less/build/amd.js +6 -0
- data/lib/less/js/less/build/build.yml +130 -0
- data/lib/less/js/less/build/require-rhino.js +12 -0
- data/lib/less/js/less/build/rhino-header.js +4 -0
- data/lib/less/js/less/build/rhino-modules.js +131 -0
- data/lib/less/js/less/build/tasks/.gitkeep +1 -0
- data/lib/less/js/less/dist/less.js +10500 -0
- data/lib/less/js/less/dist/less.min.js +20 -0
- data/lib/less/js/less/gradle/wrapper/gradle-wrapper.jar +0 -0
- data/lib/less/js/less/gradle/wrapper/gradle-wrapper.properties +6 -0
- data/lib/less/js/less/gradlew +164 -0
- data/lib/less/js/less/gradlew.bat +90 -0
- data/lib/less/js/less/index.js +1 -0
- data/lib/less/js/less/lib/less-browser/add-default-options.js +46 -0
- data/lib/less/js/less/lib/less-browser/bootstrap.js +51 -0
- data/lib/less/js/less/lib/less-browser/browser.js +64 -0
- data/lib/less/js/less/lib/less-browser/cache.js +42 -0
- data/lib/less/js/less/lib/less-browser/error-reporting.js +170 -0
- data/lib/less/js/less/lib/less-browser/file-manager.js +119 -0
- data/lib/less/js/less/lib/less-browser/image-size.js +28 -0
- data/lib/less/js/less/lib/less-browser/index.js +263 -0
- data/lib/less/js/less/lib/less-browser/log-listener.js +43 -0
- data/lib/less/js/less/lib/less-browser/utils.js +24 -0
- data/lib/less/js/less/lib/less-node/environment.js +14 -0
- data/lib/less/js/less/lib/less-node/file-manager.js +108 -0
- data/lib/less/js/less/lib/less-node/fs.js +10 -0
- data/lib/less/js/less/lib/less-node/image-size.js +57 -0
- data/lib/less/js/less/lib/less-node/index.js +74 -0
- data/lib/less/js/less/lib/less-node/lessc-helper.js +82 -0
- data/lib/less/js/less/lib/less-node/plugin-loader.js +91 -0
- data/lib/less/js/less/lib/less-node/url-file-manager.js +56 -0
- data/lib/less/js/less/lib/less-rhino/index.js +450 -0
- data/lib/less/js/less/lib/less/contexts.js +111 -0
- data/lib/less/js/less/lib/less/data/colors.js +150 -0
- data/lib/less/js/less/lib/less/data/index.js +4 -0
- data/lib/less/js/less/lib/less/data/unit-conversions.js +21 -0
- data/lib/less/js/less/lib/less/environment/abstract-file-manager.js +123 -0
- data/lib/less/js/less/lib/less/environment/environment-api.js +25 -0
- data/lib/less/js/less/lib/less/environment/environment.js +51 -0
- data/lib/less/js/less/lib/less/environment/file-manager-api.js +103 -0
- data/lib/less/js/less/lib/less/functions/color-blending.js +74 -0
- data/lib/less/js/less/lib/less/functions/color.js +322 -0
- data/lib/less/js/less/lib/less/functions/data-uri.js +85 -0
- data/lib/less/js/less/lib/less/functions/default.js +27 -0
- data/lib/less/js/less/lib/less/functions/function-caller.js +46 -0
- data/lib/less/js/less/lib/less/functions/function-registry.js +29 -0
- data/lib/less/js/less/lib/less/functions/index.js +19 -0
- data/lib/less/js/less/lib/less/functions/math-helper.js +16 -0
- data/lib/less/js/less/lib/less/functions/math.js +29 -0
- data/lib/less/js/less/lib/less/functions/number.js +81 -0
- data/lib/less/js/less/lib/less/functions/string.js +37 -0
- data/lib/less/js/less/lib/less/functions/svg.js +88 -0
- data/lib/less/js/less/lib/less/functions/types.js +89 -0
- data/lib/less/js/less/lib/less/import-manager.js +131 -0
- data/lib/less/js/less/lib/less/index.js +29 -0
- data/lib/less/js/less/lib/less/less-error.js +42 -0
- data/lib/less/js/less/lib/less/logger.js +34 -0
- data/lib/less/js/less/lib/less/parse-tree.js +60 -0
- data/lib/less/js/less/lib/less/parse.js +68 -0
- data/lib/less/js/less/lib/less/parser/chunker.js +112 -0
- data/lib/less/js/less/lib/less/parser/parser-input.js +259 -0
- data/lib/less/js/less/lib/less/parser/parser.js +1851 -0
- data/lib/less/js/less/lib/less/plugin-manager.js +114 -0
- data/lib/less/js/less/lib/less/plugins/function-importer.js +35 -0
- data/lib/less/js/less/lib/less/render.js +41 -0
- data/lib/less/js/less/lib/less/source-map-builder.js +69 -0
- data/lib/less/js/less/lib/less/source-map-output.js +138 -0
- data/lib/less/js/less/lib/less/transform-tree.js +74 -0
- data/lib/less/js/less/lib/less/tree/alpha.js +28 -0
- data/lib/less/js/less/lib/less/tree/anonymous.js +26 -0
- data/lib/less/js/less/lib/less/tree/assignment.js +27 -0
- data/lib/less/js/less/lib/less/tree/attribute.js +27 -0
- data/lib/less/js/less/lib/less/tree/call.js +62 -0
- data/lib/less/js/less/lib/less/tree/color.js +189 -0
- data/lib/less/js/less/lib/less/tree/combinator.js +23 -0
- data/lib/less/js/less/lib/less/tree/comment.js +21 -0
- data/lib/less/js/less/lib/less/tree/condition.js +37 -0
- data/lib/less/js/less/lib/less/tree/debug-info.js +38 -0
- data/lib/less/js/less/lib/less/tree/detached-ruleset.js +21 -0
- data/lib/less/js/less/lib/less/tree/dimension.js +157 -0
- data/lib/less/js/less/lib/less/tree/directive.js +133 -0
- data/lib/less/js/less/lib/less/tree/element.js +60 -0
- data/lib/less/js/less/lib/less/tree/expression.js +56 -0
- data/lib/less/js/less/lib/less/tree/extend.js +56 -0
- data/lib/less/js/less/lib/less/tree/import.js +165 -0
- data/lib/less/js/less/lib/less/tree/index.js +41 -0
- data/lib/less/js/less/lib/less/tree/javascript.js +28 -0
- data/lib/less/js/less/lib/less/tree/js-eval-node.js +61 -0
- data/lib/less/js/less/lib/less/tree/keyword.js +14 -0
- data/lib/less/js/less/lib/less/tree/media.js +144 -0
- data/lib/less/js/less/lib/less/tree/mixin-call.js +182 -0
- data/lib/less/js/less/lib/less/tree/mixin-definition.js +200 -0
- data/lib/less/js/less/lib/less/tree/negative.js +20 -0
- data/lib/less/js/less/lib/less/tree/node.js +123 -0
- data/lib/less/js/less/lib/less/tree/operation.js +48 -0
- data/lib/less/js/less/lib/less/tree/paren.js +16 -0
- data/lib/less/js/less/lib/less/tree/quoted.js +55 -0
- data/lib/less/js/less/lib/less/tree/rule.js +95 -0
- data/lib/less/js/less/lib/less/tree/ruleset-call.js +13 -0
- data/lib/less/js/less/lib/less/tree/ruleset.js +709 -0
- data/lib/less/js/less/lib/less/tree/selector.js +111 -0
- data/lib/less/js/less/lib/less/tree/unicode-descriptor.js +9 -0
- data/lib/less/js/less/lib/less/tree/unit.js +120 -0
- data/lib/less/js/less/lib/less/tree/url.js +54 -0
- data/lib/less/js/less/lib/less/tree/value.js +34 -0
- data/lib/less/js/less/lib/less/tree/variable.js +53 -0
- data/lib/less/js/less/lib/less/utils.js +20 -0
- data/lib/less/js/less/lib/less/visitors/extend-visitor.js +460 -0
- data/lib/less/js/less/lib/less/visitors/import-sequencer.js +54 -0
- data/lib/less/js/less/lib/less/visitors/import-visitor.js +189 -0
- data/lib/less/js/less/lib/less/visitors/index.js +10 -0
- data/lib/less/js/less/lib/less/visitors/join-selector-visitor.js +51 -0
- data/lib/less/js/less/lib/less/visitors/set-tree-visibility-visitor.js +38 -0
- data/lib/less/js/less/lib/less/visitors/to-css-visitor.js +383 -0
- data/lib/less/js/less/lib/less/visitors/visitor.js +152 -0
- data/lib/less/js/less/lib/source-map/source-map-0.1.31.js +1933 -0
- data/lib/less/js/less/lib/source-map/source-map-footer.js +4 -0
- data/lib/less/js/less/lib/source-map/source-map-header.js +3 -0
- data/lib/less/js/less/package.json +89 -0
- data/lib/less/js/less/test/browser/common.js +206 -0
- data/lib/less/js/less/test/browser/css/global-vars/simple.css +3 -0
- data/lib/less/js/less/test/browser/css/modify-vars/simple.css +8 -0
- data/lib/less/js/less/test/browser/css/postProcessor/postProcessor.css +4 -0
- data/lib/less/js/less/test/browser/css/relative-urls/urls.css +36 -0
- data/lib/less/js/less/test/browser/css/rootpath-relative/urls.css +35 -0
- data/lib/less/js/less/test/browser/css/rootpath/urls.css +35 -0
- data/lib/less/js/less/test/browser/css/urls.css +57 -0
- data/lib/less/js/less/test/browser/jasmine-jsreporter.js +391 -0
- data/lib/less/js/less/test/browser/less/console-errors/test-error.less +3 -0
- data/lib/less/js/less/test/browser/less/console-errors/test-error.txt +2 -0
- data/lib/less/js/less/test/browser/less/errors/image-height-error.less +3 -0
- data/lib/less/js/less/test/browser/less/errors/image-height-error.txt +4 -0
- data/lib/less/js/less/test/browser/less/errors/image-size-error.less +3 -0
- data/lib/less/js/less/test/browser/less/errors/image-size-error.txt +4 -0
- data/lib/less/js/less/test/browser/less/errors/image-width-error.less +3 -0
- data/lib/less/js/less/test/browser/less/errors/image-width-error.txt +4 -0
- data/lib/less/js/less/test/browser/less/global-vars/simple.less +3 -0
- data/lib/less/js/less/test/browser/less/imports/urls.less +4 -0
- data/lib/less/js/less/test/browser/less/imports/urls2.less +4 -0
- data/lib/less/js/less/test/browser/less/modify-vars/imports/simple2.less +4 -0
- data/lib/less/js/less/test/browser/less/modify-vars/simple.less +8 -0
- data/lib/less/js/less/test/browser/less/nested-gradient-with-svg-gradient/mixin-consumer.less +5 -0
- data/lib/less/js/less/test/browser/less/nested-gradient-with-svg-gradient/svg-gradient-mixin.less +15 -0
- data/lib/less/js/less/test/browser/less/postProcessor/postProcessor.less +4 -0
- data/lib/less/js/less/test/browser/less/relative-urls/urls.less +34 -0
- data/lib/less/js/less/test/browser/less/rootpath-relative/urls.less +33 -0
- data/lib/less/js/less/test/browser/less/rootpath/urls.less +33 -0
- data/lib/less/js/less/test/browser/less/urls.less +65 -0
- data/lib/less/js/less/test/browser/runner-VisitorPlugin-options.js +3 -0
- data/lib/less/js/less/test/browser/runner-VisitorPlugin.js +3 -0
- data/lib/less/js/less/test/browser/runner-browser-options.js +51 -0
- data/lib/less/js/less/test/browser/runner-browser-spec.js +12 -0
- data/lib/less/js/less/test/browser/runner-console-errors.js +5 -0
- data/lib/less/js/less/test/browser/runner-errors-options.js +4 -0
- data/lib/less/js/less/test/browser/runner-errors-spec.js +3 -0
- data/lib/less/js/less/test/browser/runner-filemanagerPlugin-options.js +4 -0
- data/lib/less/js/less/test/browser/runner-filemanagerPlugin.js +3 -0
- data/lib/less/js/less/test/browser/runner-global-vars-options.js +7 -0
- data/lib/less/js/less/test/browser/runner-global-vars-spec.js +3 -0
- data/lib/less/js/less/test/browser/runner-legacy-options.js +5 -0
- data/lib/less/js/less/test/browser/runner-legacy-spec.js +3 -0
- data/lib/less/js/less/test/browser/runner-main-options.js +18 -0
- data/lib/less/js/less/test/browser/runner-main-spec.js +7 -0
- data/lib/less/js/less/test/browser/runner-modify-vars-options.js +5 -0
- data/lib/less/js/less/test/browser/runner-modify-vars-spec.js +33 -0
- data/lib/less/js/less/test/browser/runner-no-js-errors-options.js +4 -0
- data/lib/less/js/less/test/browser/runner-no-js-errors-spec.js +3 -0
- data/lib/less/js/less/test/browser/runner-postProcessor-options.js +5 -0
- data/lib/less/js/less/test/browser/runner-postProcessor.js +3 -0
- data/lib/less/js/less/test/browser/runner-postProcessorPlugin-options.js +3 -0
- data/lib/less/js/less/test/browser/runner-postProcessorPlugin.js +3 -0
- data/lib/less/js/less/test/browser/runner-preProcessorPlugin-options.js +3 -0
- data/lib/less/js/less/test/browser/runner-preProcessorPlugin.js +3 -0
- data/lib/less/js/less/test/browser/runner-production-options.js +3 -0
- data/lib/less/js/less/test/browser/runner-production-spec.js +5 -0
- data/lib/less/js/less/test/browser/runner-relative-urls-options.js +3 -0
- data/lib/less/js/less/test/browser/runner-relative-urls-spec.js +3 -0
- data/lib/less/js/less/test/browser/runner-rootpath-options.js +3 -0
- data/lib/less/js/less/test/browser/runner-rootpath-relative-options.js +4 -0
- data/lib/less/js/less/test/browser/runner-rootpath-relative-spec.js +3 -0
- data/lib/less/js/less/test/browser/runner-rootpath-spec.js +3 -0
- data/lib/less/js/less/test/browser/runner-strict-units-options.js +5 -0
- data/lib/less/js/less/test/browser/runner-strict-units-spec.js +3 -0
- data/lib/less/js/less/test/browser/test-runner-template.tmpl +95 -0
- data/lib/less/js/less/test/copy-bom.js +72 -0
- data/lib/less/js/less/test/css/charsets.css +1 -0
- data/lib/less/js/less/test/css/colors.css +87 -0
- data/lib/less/js/less/test/css/comments.css +83 -0
- data/lib/less/js/less/test/css/comments2.css +18 -0
- data/lib/less/js/less/test/css/compression/compression.css +3 -0
- data/lib/less/js/less/test/css/css-3.css +157 -0
- data/lib/less/js/less/test/css/css-escapes.css +24 -0
- data/lib/less/js/less/test/css/css-guards.css +37 -0
- data/lib/less/js/less/test/css/css.css +95 -0
- data/lib/less/js/less/test/css/debug/linenumbers-all.css +50 -0
- data/lib/less/js/less/test/css/debug/linenumbers-comments.css +41 -0
- data/lib/less/js/less/test/css/debug/linenumbers-mediaquery.css +41 -0
- data/lib/less/js/less/test/css/detached-rulesets.css +76 -0
- data/lib/less/js/less/test/css/directives-bubling.css +119 -0
- data/lib/less/js/less/test/css/empty.css +0 -0
- data/lib/less/js/less/test/css/extend-chaining.css +81 -0
- data/lib/less/js/less/test/css/extend-clearfix.css +19 -0
- data/lib/less/js/less/test/css/extend-exact.css +37 -0
- data/lib/less/js/less/test/css/extend-media.css +24 -0
- data/lib/less/js/less/test/css/extend-nest.css +57 -0
- data/lib/less/js/less/test/css/extend-selector.css +87 -0
- data/lib/less/js/less/test/css/extend.css +76 -0
- data/lib/less/js/less/test/css/extract-and-length.css +133 -0
- data/lib/less/js/less/test/css/filemanagerPlugin/filemanager.css +3 -0
- data/lib/less/js/less/test/css/functions.css +201 -0
- data/lib/less/js/less/test/css/globalVars/extended.css +12 -0
- data/lib/less/js/less/test/css/globalVars/simple.css +6 -0
- data/lib/less/js/less/test/css/ie-filters.css +9 -0
- data/lib/less/js/less/test/css/import-inline.css +8 -0
- data/lib/less/js/less/test/css/import-interpolation.css +13 -0
- data/lib/less/js/less/test/css/import-once.css +15 -0
- data/lib/less/js/less/test/css/import-reference-issues.css +24 -0
- data/lib/less/js/less/test/css/import-reference.css +97 -0
- data/lib/less/js/less/test/css/import.css +49 -0
- data/lib/less/js/less/test/css/include-path-string/include-path-string.css +3 -0
- data/lib/less/js/less/test/css/include-path/include-path.css +9 -0
- data/lib/less/js/less/test/css/javascript.css +28 -0
- data/lib/less/js/less/test/css/lazy-eval.css +3 -0
- data/lib/less/js/less/test/css/legacy/legacy.css +21 -0
- data/lib/less/js/less/test/css/media.css +218 -0
- data/lib/less/js/less/test/css/merge.css +34 -0
- data/lib/less/js/less/test/css/mixins-args.css +163 -0
- data/lib/less/js/less/test/css/mixins-closure.css +9 -0
- data/lib/less/js/less/test/css/mixins-guards-default-func.css +129 -0
- data/lib/less/js/less/test/css/mixins-guards.css +211 -0
- data/lib/less/js/less/test/css/mixins-important.css +57 -0
- data/lib/less/js/less/test/css/mixins-interpolated.css +43 -0
- data/lib/less/js/less/test/css/mixins-named-args.css +27 -0
- data/lib/less/js/less/test/css/mixins-nested.css +14 -0
- data/lib/less/js/less/test/css/mixins-pattern.css +51 -0
- data/lib/less/js/less/test/css/mixins.css +144 -0
- data/lib/less/js/less/test/css/modifyVars/extended.css +9 -0
- data/lib/less/js/less/test/css/no-output.css +0 -0
- data/lib/less/js/less/test/css/no-strict-math/mixins-guards.css +12 -0
- data/lib/less/js/less/test/css/no-strict-math/no-sm-operations.css +12 -0
- data/lib/less/js/less/test/css/operations.css +50 -0
- data/lib/less/js/less/test/css/parens.css +36 -0
- data/lib/less/js/less/test/css/plugin.css +44 -0
- data/lib/less/js/less/test/css/postProcessorPlugin/postProcessor.css +4 -0
- data/lib/less/js/less/test/css/preProcessorPlugin/preProcessor.css +3 -0
- data/lib/less/js/less/test/css/property-name-interp.css +21 -0
- data/lib/less/js/less/test/css/rulesets.css +33 -0
- data/lib/less/js/less/test/css/scope.css +38 -0
- data/lib/less/js/less/test/css/selectors.css +170 -0
- data/lib/less/js/less/test/css/static-urls/urls.css +46 -0
- data/lib/less/js/less/test/css/strict-units/strict-units.css +4 -0
- data/lib/less/js/less/test/css/strings.css +55 -0
- data/lib/less/js/less/test/css/url-args/urls.css +56 -0
- data/lib/less/js/less/test/css/urls.css +87 -0
- data/lib/less/js/less/test/css/variables-in-at-rules.css +18 -0
- data/lib/less/js/less/test/css/variables.css +68 -0
- data/lib/less/js/less/test/css/visitorPlugin/visitor.css +3 -0
- data/lib/less/js/less/test/css/whitespace.css +42 -0
- data/lib/less/js/less/test/data/data-uri-fail.png +0 -0
- data/lib/less/js/less/test/data/image.jpg +0 -0
- data/lib/less/js/less/test/data/image.svg +4 -0
- data/lib/less/js/less/test/data/page.html +1 -0
- data/lib/less/js/less/test/index.js +59 -0
- data/lib/less/js/less/test/less-test.js +386 -0
- data/lib/less/js/less/test/less/charsets.less +3 -0
- data/lib/less/js/less/test/less/colors.less +98 -0
- data/lib/less/js/less/test/less/comments.less +102 -0
- data/lib/less/js/less/test/less/comments2.less +31 -0
- data/lib/less/js/less/test/less/compression/compression.less +36 -0
- data/lib/less/js/less/test/less/css-3.less +162 -0
- data/lib/less/js/less/test/less/css-escapes.less +33 -0
- data/lib/less/js/less/test/less/css-guards.less +103 -0
- data/lib/less/js/less/test/less/css.less +108 -0
- data/lib/less/js/less/test/less/debug/import/test.less +25 -0
- data/lib/less/js/less/test/less/debug/linenumbers.less +33 -0
- data/lib/less/js/less/test/less/detached-rulesets.less +112 -0
- data/lib/less/js/less/test/less/directives-bubling.less +142 -0
- data/lib/less/js/less/test/less/empty.less +0 -0
- data/lib/less/js/less/test/less/errors/add-mixed-units.less +3 -0
- data/lib/less/js/less/test/less/errors/add-mixed-units.txt +4 -0
- data/lib/less/js/less/test/less/errors/add-mixed-units2.less +3 -0
- data/lib/less/js/less/test/less/errors/add-mixed-units2.txt +4 -0
- data/lib/less/js/less/test/less/errors/at-rules-undefined-var.less +4 -0
- data/lib/less/js/less/test/less/errors/at-rules-undefined-var.txt +4 -0
- data/lib/less/js/less/test/less/errors/bad-variable-declaration1.less +1 -0
- data/lib/less/js/less/test/less/errors/bad-variable-declaration1.txt +2 -0
- data/lib/less/js/less/test/less/errors/color-func-invalid-color.less +3 -0
- data/lib/less/js/less/test/less/errors/color-func-invalid-color.txt +4 -0
- data/lib/less/js/less/test/less/errors/color-invalid-hex-code.less +3 -0
- data/lib/less/js/less/test/less/errors/color-invalid-hex-code.txt +4 -0
- data/lib/less/js/less/test/less/errors/color-invalid-hex-code2.less +3 -0
- data/lib/less/js/less/test/less/errors/color-invalid-hex-code2.txt +4 -0
- data/lib/less/js/less/test/less/errors/css-guard-default-func.less +4 -0
- data/lib/less/js/less/test/less/errors/css-guard-default-func.txt +4 -0
- data/lib/less/js/less/test/less/errors/detached-ruleset-1.less +6 -0
- data/lib/less/js/less/test/less/errors/detached-ruleset-1.txt +4 -0
- data/lib/less/js/less/test/less/errors/detached-ruleset-2.less +6 -0
- data/lib/less/js/less/test/less/errors/detached-ruleset-2.txt +4 -0
- data/lib/less/js/less/test/less/errors/detached-ruleset-3.less +4 -0
- data/lib/less/js/less/test/less/errors/detached-ruleset-3.txt +4 -0
- data/lib/less/js/less/test/less/errors/detached-ruleset-5.less +4 -0
- data/lib/less/js/less/test/less/errors/detached-ruleset-5.txt +3 -0
- data/lib/less/js/less/test/less/errors/detached-ruleset-6.less +5 -0
- data/lib/less/js/less/test/less/errors/detached-ruleset-6.txt +4 -0
- data/lib/less/js/less/test/less/errors/divide-mixed-units.less +3 -0
- data/lib/less/js/less/test/less/errors/divide-mixed-units.txt +4 -0
- data/lib/less/js/less/test/less/errors/extend-no-selector.less +3 -0
- data/lib/less/js/less/test/less/errors/extend-no-selector.txt +3 -0
- data/lib/less/js/less/test/less/errors/extend-not-at-end.less +3 -0
- data/lib/less/js/less/test/less/errors/extend-not-at-end.txt +3 -0
- data/lib/less/js/less/test/less/errors/import-malformed.less +1 -0
- data/lib/less/js/less/test/less/errors/import-malformed.txt +3 -0
- data/lib/less/js/less/test/less/errors/import-missing.less +6 -0
- data/lib/less/js/less/test/less/errors/import-missing.txt +3 -0
- data/lib/less/js/less/test/less/errors/import-no-semi.less +1 -0
- data/lib/less/js/less/test/less/errors/import-no-semi.txt +2 -0
- data/lib/less/js/less/test/less/errors/import-subfolder1.less +1 -0
- data/lib/less/js/less/test/less/errors/import-subfolder1.txt +3 -0
- data/lib/less/js/less/test/less/errors/import-subfolder2.less +1 -0
- data/lib/less/js/less/test/less/errors/import-subfolder2.txt +4 -0
- data/lib/less/js/less/test/less/errors/imports/import-subfolder1.less +1 -0
- data/lib/less/js/less/test/less/errors/imports/import-subfolder2.less +1 -0
- data/lib/less/js/less/test/less/errors/imports/import-test.less +4 -0
- data/lib/less/js/less/test/less/errors/imports/subfolder/mixin-not-defined.less +1 -0
- data/lib/less/js/less/test/less/errors/imports/subfolder/parse-error-curly-bracket.less +1 -0
- data/lib/less/js/less/test/less/errors/javascript-error.less +3 -0
- data/lib/less/js/less/test/less/errors/javascript-error.txt +4 -0
- data/lib/less/js/less/test/less/errors/javascript-undefined-var.less +3 -0
- data/lib/less/js/less/test/less/errors/javascript-undefined-var.txt +4 -0
- data/lib/less/js/less/test/less/errors/mixed-mixin-definition-args-1.less +6 -0
- data/lib/less/js/less/test/less/errors/mixed-mixin-definition-args-1.txt +4 -0
- data/lib/less/js/less/test/less/errors/mixed-mixin-definition-args-2.less +6 -0
- data/lib/less/js/less/test/less/errors/mixed-mixin-definition-args-2.txt +4 -0
- data/lib/less/js/less/test/less/errors/mixin-not-defined.less +11 -0
- data/lib/less/js/less/test/less/errors/mixin-not-defined.txt +3 -0
- data/lib/less/js/less/test/less/errors/mixin-not-matched.less +6 -0
- data/lib/less/js/less/test/less/errors/mixin-not-matched.txt +3 -0
- data/lib/less/js/less/test/less/errors/mixin-not-matched2.less +6 -0
- data/lib/less/js/less/test/less/errors/mixin-not-matched2.txt +3 -0
- data/lib/less/js/less/test/less/errors/mixin-not-visible-in-scope-1.less +9 -0
- data/lib/less/js/less/test/less/errors/mixin-not-visible-in-scope-1.txt +4 -0
- data/lib/less/js/less/test/less/errors/mixins-guards-default-func-1.less +9 -0
- data/lib/less/js/less/test/less/errors/mixins-guards-default-func-1.txt +4 -0
- data/lib/less/js/less/test/less/errors/mixins-guards-default-func-2.less +9 -0
- data/lib/less/js/less/test/less/errors/mixins-guards-default-func-2.txt +4 -0
- data/lib/less/js/less/test/less/errors/mixins-guards-default-func-3.less +9 -0
- data/lib/less/js/less/test/less/errors/mixins-guards-default-func-3.txt +4 -0
- data/lib/less/js/less/test/less/errors/multiple-guards-on-css-selectors.less +4 -0
- data/lib/less/js/less/test/less/errors/multiple-guards-on-css-selectors.txt +4 -0
- data/lib/less/js/less/test/less/errors/multiple-guards-on-css-selectors2.less +4 -0
- data/lib/less/js/less/test/less/errors/multiple-guards-on-css-selectors2.txt +4 -0
- data/lib/less/js/less/test/less/errors/multiply-mixed-units.less +7 -0
- data/lib/less/js/less/test/less/errors/multiply-mixed-units.txt +4 -0
- data/lib/less/js/less/test/less/errors/parens-error-1.less +3 -0
- data/lib/less/js/less/test/less/errors/parens-error-1.txt +4 -0
- data/lib/less/js/less/test/less/errors/parens-error-2.less +3 -0
- data/lib/less/js/less/test/less/errors/parens-error-2.txt +4 -0
- data/lib/less/js/less/test/less/errors/parens-error-3.less +3 -0
- data/lib/less/js/less/test/less/errors/parens-error-3.txt +4 -0
- data/lib/less/js/less/test/less/errors/parse-error-curly-bracket.less +4 -0
- data/lib/less/js/less/test/less/errors/parse-error-curly-bracket.txt +4 -0
- data/lib/less/js/less/test/less/errors/parse-error-media-no-block-1.less +5 -0
- data/lib/less/js/less/test/less/errors/parse-error-media-no-block-1.txt +3 -0
- data/lib/less/js/less/test/less/errors/parse-error-media-no-block-2.less +1 -0
- data/lib/less/js/less/test/less/errors/parse-error-media-no-block-2.txt +2 -0
- data/lib/less/js/less/test/less/errors/parse-error-media-no-block-3.less +4 -0
- data/lib/less/js/less/test/less/errors/parse-error-media-no-block-3.txt +3 -0
- data/lib/less/js/less/test/less/errors/parse-error-missing-bracket.less +2 -0
- data/lib/less/js/less/test/less/errors/parse-error-missing-bracket.txt +3 -0
- data/lib/less/js/less/test/less/errors/parse-error-missing-parens.less +5 -0
- data/lib/less/js/less/test/less/errors/parse-error-missing-parens.txt +3 -0
- data/lib/less/js/less/test/less/errors/parse-error-with-import.less +13 -0
- data/lib/less/js/less/test/less/errors/parse-error-with-import.txt +4 -0
- data/lib/less/js/less/test/less/errors/percentage-missing-space.less +3 -0
- data/lib/less/js/less/test/less/errors/percentage-missing-space.txt +4 -0
- data/lib/less/js/less/test/less/errors/percentage-non-number-argument.less +3 -0
- data/lib/less/js/less/test/less/errors/percentage-non-number-argument.txt +4 -0
- data/lib/less/js/less/test/less/errors/property-asterisk-only-name.less +3 -0
- data/lib/less/js/less/test/less/errors/property-asterisk-only-name.txt +4 -0
- data/lib/less/js/less/test/less/errors/property-ie5-hack.less +3 -0
- data/lib/less/js/less/test/less/errors/property-ie5-hack.txt +3 -0
- data/lib/less/js/less/test/less/errors/property-in-root.less +4 -0
- data/lib/less/js/less/test/less/errors/property-in-root.txt +4 -0
- data/lib/less/js/less/test/less/errors/property-in-root2.less +1 -0
- data/lib/less/js/less/test/less/errors/property-in-root2.txt +4 -0
- data/lib/less/js/less/test/less/errors/property-in-root3.less +4 -0
- data/lib/less/js/less/test/less/errors/property-in-root3.txt +3 -0
- data/lib/less/js/less/test/less/errors/property-interp-not-defined.less +1 -0
- data/lib/less/js/less/test/less/errors/property-interp-not-defined.txt +2 -0
- data/lib/less/js/less/test/less/errors/recursive-variable.less +1 -0
- data/lib/less/js/less/test/less/errors/recursive-variable.txt +2 -0
- data/lib/less/js/less/test/less/errors/single-character.less +1 -0
- data/lib/less/js/less/test/less/errors/single-character.txt +2 -0
- data/lib/less/js/less/test/less/errors/svg-gradient1.less +3 -0
- data/lib/less/js/less/test/less/errors/svg-gradient1.txt +4 -0
- data/lib/less/js/less/test/less/errors/svg-gradient2.less +3 -0
- data/lib/less/js/less/test/less/errors/svg-gradient2.txt +4 -0
- data/lib/less/js/less/test/less/errors/svg-gradient3.less +3 -0
- data/lib/less/js/less/test/less/errors/svg-gradient3.txt +4 -0
- data/lib/less/js/less/test/less/errors/svg-gradient4.less +4 -0
- data/lib/less/js/less/test/less/errors/svg-gradient4.txt +4 -0
- data/lib/less/js/less/test/less/errors/svg-gradient5.less +4 -0
- data/lib/less/js/less/test/less/errors/svg-gradient5.txt +4 -0
- data/lib/less/js/less/test/less/errors/svg-gradient6.less +4 -0
- data/lib/less/js/less/test/less/errors/svg-gradient6.txt +4 -0
- data/lib/less/js/less/test/less/errors/unit-function.less +3 -0
- data/lib/less/js/less/test/less/errors/unit-function.txt +4 -0
- data/lib/less/js/less/test/less/extend-chaining.less +91 -0
- data/lib/less/js/less/test/less/extend-clearfix.less +19 -0
- data/lib/less/js/less/test/less/extend-exact.less +46 -0
- data/lib/less/js/less/test/less/extend-media.less +24 -0
- data/lib/less/js/less/test/less/extend-nest.less +65 -0
- data/lib/less/js/less/test/less/extend-selector.less +110 -0
- data/lib/less/js/less/test/less/extend.less +81 -0
- data/lib/less/js/less/test/less/extract-and-length.less +133 -0
- data/lib/less/js/less/test/less/filemanagerPlugin/colors.test +1 -0
- data/lib/less/js/less/test/less/filemanagerPlugin/filemanager.less +4 -0
- data/lib/less/js/less/test/less/functions.less +232 -0
- data/lib/less/js/less/test/less/globalVars/extended.json +5 -0
- data/lib/less/js/less/test/less/globalVars/extended.less +10 -0
- data/lib/less/js/less/test/less/globalVars/simple.json +3 -0
- data/lib/less/js/less/test/less/globalVars/simple.less +3 -0
- data/lib/less/js/less/test/less/ie-filters.less +15 -0
- data/lib/less/js/less/test/less/import-inline.less +3 -0
- data/lib/less/js/less/test/less/import-interpolation.less +8 -0
- data/lib/less/js/less/test/less/import-once.less +6 -0
- data/lib/less/js/less/test/less/import-reference-issues.less +50 -0
- data/lib/less/js/less/test/less/import-reference-issues/appender-reference-1968.less +6 -0
- data/lib/less/js/less/test/less/import-reference-issues/global-scope-import.less +13 -0
- data/lib/less/js/less/test/less/import-reference-issues/global-scope-nested.less +3 -0
- data/lib/less/js/less/test/less/import-reference-issues/mixin-1968.less +8 -0
- data/lib/less/js/less/test/less/import-reference-issues/multiple-import-nested.less +12 -0
- data/lib/less/js/less/test/less/import-reference-issues/multiple-import.less +10 -0
- data/lib/less/js/less/test/less/import-reference-issues/simple-mixin.css +3 -0
- data/lib/less/js/less/test/less/import-reference-issues/simple-ruleset-2162.less +3 -0
- data/lib/less/js/less/test/less/import-reference.less +26 -0
- data/lib/less/js/less/test/less/import.less +31 -0
- data/lib/less/js/less/test/less/import/css-import.less +1 -0
- data/lib/less/js/less/test/less/import/deeper/deeper-2/url-import-2.less +3 -0
- data/lib/less/js/less/test/less/import/deeper/deeper-2/url-import.less +1 -0
- data/lib/less/js/less/test/less/import/deeper/import-once-test-a.less +1 -0
- data/lib/less/js/less/test/less/import/deeper/url-import.less +1 -0
- data/lib/less/js/less/test/less/import/import-and-relative-paths-test.less +17 -0
- data/lib/less/js/less/test/less/import/import-charset-test.less +1 -0
- data/lib/less/js/less/test/less/import/import-inline-invalid-css.less +1 -0
- data/lib/less/js/less/test/less/import/import-interpolation.less +2 -0
- data/lib/less/js/less/test/less/import/import-interpolation2.less +5 -0
- data/lib/less/js/less/test/less/import/import-once-test-c.less +6 -0
- data/lib/less/js/less/test/less/import/import-reference.less +98 -0
- data/lib/less/js/less/test/less/import/import-test-a.less +5 -0
- data/lib/less/js/less/test/less/import/import-test-b.less +8 -0
- data/lib/less/js/less/test/less/import/import-test-c.less +6 -0
- data/lib/less/js/less/test/less/import/import-test-d.css +1 -0
- data/lib/less/js/less/test/less/import/import-test-e.less +2 -0
- data/lib/less/js/less/test/less/import/import-test-f.less +5 -0
- data/lib/less/js/less/test/less/import/imports/font.less +8 -0
- data/lib/less/js/less/test/less/import/imports/logo.less +6 -0
- data/lib/less/js/less/test/less/import/interpolation-vars.less +6 -0
- data/lib/less/js/less/test/less/import/invalid-css.less +1 -0
- data/lib/less/js/less/test/less/import/urls.less +1 -0
- data/lib/less/js/less/test/less/include-path-string/include-path-string.less +3 -0
- data/lib/less/js/less/test/less/include-path/include-path.less +8 -0
- data/lib/less/js/less/test/less/javascript.less +38 -0
- data/lib/less/js/less/test/less/lazy-eval.less +6 -0
- data/lib/less/js/less/test/less/legacy/legacy.less +21 -0
- data/lib/less/js/less/test/less/media.less +234 -0
- data/lib/less/js/less/test/less/merge.less +78 -0
- data/lib/less/js/less/test/less/mixins-args.less +263 -0
- data/lib/less/js/less/test/less/mixins-closure.less +26 -0
- data/lib/less/js/less/test/less/mixins-guards-default-func.less +195 -0
- data/lib/less/js/less/test/less/mixins-guards.less +358 -0
- data/lib/less/js/less/test/less/mixins-important.less +53 -0
- data/lib/less/js/less/test/less/mixins-interpolated.less +75 -0
- data/lib/less/js/less/test/less/mixins-named-args.less +36 -0
- data/lib/less/js/less/test/less/mixins-nested.less +22 -0
- data/lib/less/js/less/test/less/mixins-pattern.less +102 -0
- data/lib/less/js/less/test/less/mixins.less +145 -0
- data/lib/less/js/less/test/less/modifyVars/extended.json +5 -0
- data/lib/less/js/less/test/less/modifyVars/extended.less +11 -0
- data/lib/less/js/less/test/less/nested-gradient-with-svg-gradient/mixin-consumer.less +5 -0
- data/lib/less/js/less/test/less/nested-gradient-with-svg-gradient/svg-gradient-mixin.less +15 -0
- data/lib/less/js/less/test/less/no-js-errors/no-js-errors.less +3 -0
- data/lib/less/js/less/test/less/no-js-errors/no-js-errors.txt +4 -0
- data/lib/less/js/less/test/less/no-output.less +2 -0
- data/lib/less/js/less/test/less/no-strict-math/mixins-guards.less +25 -0
- data/lib/less/js/less/test/less/no-strict-math/no-sm-operations.less +10 -0
- data/lib/less/js/less/test/less/operations.less +63 -0
- data/lib/less/js/less/test/less/parens.less +45 -0
- data/lib/less/js/less/test/less/plugin.less +85 -0
- data/lib/less/js/less/test/less/plugin/plugin-global.js +9 -0
- data/lib/less/js/less/test/less/plugin/plugin-local.js +8 -0
- data/lib/less/js/less/test/less/plugin/plugin-transitive.js +5 -0
- data/lib/less/js/less/test/less/plugin/plugin-transitive.less +5 -0
- data/lib/less/js/less/test/less/postProcessorPlugin/postProcessor.less +4 -0
- data/lib/less/js/less/test/less/preProcessorPlugin/preProcessor.less +3 -0
- data/lib/less/js/less/test/less/property-name-interp.less +56 -0
- data/lib/less/js/less/test/less/rulesets.less +30 -0
- data/lib/less/js/less/test/less/scope.less +104 -0
- data/lib/less/js/less/test/less/selectors.less +184 -0
- data/lib/less/js/less/test/less/sourcemaps-empty/empty.less +0 -0
- data/lib/less/js/less/test/less/sourcemaps-empty/var-defs.less +1 -0
- data/lib/less/js/less/test/less/sourcemaps/basic.json +3 -0
- data/lib/less/js/less/test/less/sourcemaps/basic.less +27 -0
- data/lib/less/js/less/test/less/sourcemaps/imported.css +7 -0
- data/lib/less/js/less/test/less/static-urls/urls.less +33 -0
- data/lib/less/js/less/test/less/strict-units/strict-units.less +4 -0
- data/lib/less/js/less/test/less/strings.less +73 -0
- data/lib/less/js/less/test/less/url-args/urls.less +63 -0
- data/lib/less/js/less/test/less/urls.less +94 -0
- data/lib/less/js/less/test/less/variables-in-at-rules.less +20 -0
- data/lib/less/js/less/test/less/variables.less +119 -0
- data/lib/less/js/less/test/less/visitorPlugin/visitor.less +4 -0
- data/lib/less/js/less/test/less/whitespace.less +44 -0
- data/lib/less/js/less/test/modify-vars.js +19 -0
- data/lib/less/js/less/test/plugins/filemanager/index.js +19 -0
- data/lib/less/js/less/test/plugins/postprocess/index.js +14 -0
- data/lib/less/js/less/test/plugins/preprocess/index.js +19 -0
- data/lib/less/js/less/test/plugins/visitor/index.js +24 -0
- data/lib/less/js/less/test/rhino/test-header.js +15 -0
- data/lib/less/js/less/test/sourcemaps/basic.json +1 -0
- data/lib/less/js/less/test/sourcemaps/index.html +17 -0
- data/lib/less/js/node-mime/.gitignore +2 -0
- data/lib/less/js/node-mime/.npmignore +0 -0
- data/lib/less/js/node-mime/LICENSE +19 -0
- data/lib/less/js/node-mime/README.md +90 -0
- data/lib/less/js/node-mime/build/build.js +11 -0
- data/lib/less/js/node-mime/build/test.js +57 -0
- data/lib/less/js/node-mime/cli.js +8 -0
- data/lib/less/js/node-mime/mime.js +108 -0
- data/lib/less/js/node-mime/package.json +41 -0
- data/lib/less/js/node-mime/types.json +1 -0
- data/lib/less/loader.rb +13 -0
- data/lib/less/parser.rb +62 -0
- data/lib/less/runner.js +20 -0
- data/lib/less/version.rb +3 -0
- data/script/bootstrap +6 -0
- data/script/cibuild +7 -0
- data/spec/less/parser_spec.rb +170 -0
- data/spec/spec_helper.rb +3 -0
- data/spec/support/custom_functions/custom_functions.js +7 -0
- data/spec/support/custom_functions/custom_functions.less +3 -0
- data/spec/support/faulty/faulty.less +3 -0
- data/spec/support/less.js.tests-custom-functions.js +20 -0
- data/spec/support/one/one.less +1 -0
- data/spec/support/two/two.less +1 -0
- metadata +733 -0
@@ -0,0 +1,42 @@
|
|
1
|
+
// Cache system is a bit outdated and could do with work
|
2
|
+
|
3
|
+
module.exports = function(window, options, logger) {
|
4
|
+
var cache = null;
|
5
|
+
if (options.env !== 'development') {
|
6
|
+
try {
|
7
|
+
cache = (typeof window.localStorage === 'undefined') ? null : window.localStorage;
|
8
|
+
} catch (_) {}
|
9
|
+
}
|
10
|
+
return {
|
11
|
+
setCSS: function(path, lastModified, modifyVars, styles) {
|
12
|
+
if (cache) {
|
13
|
+
logger.info('saving ' + path + ' to cache.');
|
14
|
+
try {
|
15
|
+
cache.setItem(path, styles);
|
16
|
+
cache.setItem(path + ':timestamp', lastModified);
|
17
|
+
if (modifyVars) {
|
18
|
+
cache.setItem(path + ':vars', JSON.stringify(modifyVars));
|
19
|
+
}
|
20
|
+
} catch(e) {
|
21
|
+
//TODO - could do with adding more robust error handling
|
22
|
+
logger.error('failed to save "' + path + '" to local storage for caching.');
|
23
|
+
}
|
24
|
+
}
|
25
|
+
},
|
26
|
+
getCSS: function(path, webInfo, modifyVars) {
|
27
|
+
var css = cache && cache.getItem(path),
|
28
|
+
timestamp = cache && cache.getItem(path + ':timestamp'),
|
29
|
+
vars = cache && cache.getItem(path + ':vars');
|
30
|
+
|
31
|
+
modifyVars = modifyVars || {};
|
32
|
+
|
33
|
+
if (timestamp && webInfo.lastModified &&
|
34
|
+
(new Date(webInfo.lastModified).valueOf() ===
|
35
|
+
new Date(timestamp).valueOf()) &&
|
36
|
+
(!modifyVars && !vars || JSON.stringify(modifyVars) === vars)) {
|
37
|
+
// Use local copy
|
38
|
+
return css;
|
39
|
+
}
|
40
|
+
}
|
41
|
+
};
|
42
|
+
};
|
@@ -0,0 +1,170 @@
|
|
1
|
+
var utils = require("./utils"),
|
2
|
+
browser = require("./browser");
|
3
|
+
|
4
|
+
module.exports = function(window, less, options) {
|
5
|
+
|
6
|
+
function errorHTML(e, rootHref) {
|
7
|
+
var id = 'less-error-message:' + utils.extractId(rootHref || "");
|
8
|
+
var template = '<li><label>{line}</label><pre class="{class}">{content}</pre></li>';
|
9
|
+
var elem = window.document.createElement('div'), timer, content, errors = [];
|
10
|
+
var filename = e.filename || rootHref;
|
11
|
+
var filenameNoPath = filename.match(/([^\/]+(\?.*)?)$/)[1];
|
12
|
+
|
13
|
+
elem.id = id;
|
14
|
+
elem.className = "less-error-message";
|
15
|
+
|
16
|
+
content = '<h3>' + (e.type || "Syntax") + "Error: " + (e.message || 'There is an error in your .less file') +
|
17
|
+
'</h3>' + '<p>in <a href="' + filename + '">' + filenameNoPath + "</a> ";
|
18
|
+
|
19
|
+
var errorline = function (e, i, classname) {
|
20
|
+
if (e.extract[i] !== undefined) {
|
21
|
+
errors.push(template.replace(/\{line\}/, (parseInt(e.line, 10) || 0) + (i - 1))
|
22
|
+
.replace(/\{class\}/, classname)
|
23
|
+
.replace(/\{content\}/, e.extract[i]));
|
24
|
+
}
|
25
|
+
};
|
26
|
+
|
27
|
+
if (e.extract) {
|
28
|
+
errorline(e, 0, '');
|
29
|
+
errorline(e, 1, 'line');
|
30
|
+
errorline(e, 2, '');
|
31
|
+
content += 'on line ' + e.line + ', column ' + (e.column + 1) + ':</p>' +
|
32
|
+
'<ul>' + errors.join('') + '</ul>';
|
33
|
+
}
|
34
|
+
if (e.stack && (e.extract || options.logLevel >= 4)) {
|
35
|
+
content += '<br/>Stack Trace</br />' + e.stack.split('\n').slice(1).join('<br/>');
|
36
|
+
}
|
37
|
+
elem.innerHTML = content;
|
38
|
+
|
39
|
+
// CSS for error messages
|
40
|
+
browser.createCSS(window.document, [
|
41
|
+
'.less-error-message ul, .less-error-message li {',
|
42
|
+
'list-style-type: none;',
|
43
|
+
'margin-right: 15px;',
|
44
|
+
'padding: 4px 0;',
|
45
|
+
'margin: 0;',
|
46
|
+
'}',
|
47
|
+
'.less-error-message label {',
|
48
|
+
'font-size: 12px;',
|
49
|
+
'margin-right: 15px;',
|
50
|
+
'padding: 4px 0;',
|
51
|
+
'color: #cc7777;',
|
52
|
+
'}',
|
53
|
+
'.less-error-message pre {',
|
54
|
+
'color: #dd6666;',
|
55
|
+
'padding: 4px 0;',
|
56
|
+
'margin: 0;',
|
57
|
+
'display: inline-block;',
|
58
|
+
'}',
|
59
|
+
'.less-error-message pre.line {',
|
60
|
+
'color: #ff0000;',
|
61
|
+
'}',
|
62
|
+
'.less-error-message h3 {',
|
63
|
+
'font-size: 20px;',
|
64
|
+
'font-weight: bold;',
|
65
|
+
'padding: 15px 0 5px 0;',
|
66
|
+
'margin: 0;',
|
67
|
+
'}',
|
68
|
+
'.less-error-message a {',
|
69
|
+
'color: #10a',
|
70
|
+
'}',
|
71
|
+
'.less-error-message .error {',
|
72
|
+
'color: red;',
|
73
|
+
'font-weight: bold;',
|
74
|
+
'padding-bottom: 2px;',
|
75
|
+
'border-bottom: 1px dashed red;',
|
76
|
+
'}'
|
77
|
+
].join('\n'), { title: 'error-message' });
|
78
|
+
|
79
|
+
elem.style.cssText = [
|
80
|
+
"font-family: Arial, sans-serif",
|
81
|
+
"border: 1px solid #e00",
|
82
|
+
"background-color: #eee",
|
83
|
+
"border-radius: 5px",
|
84
|
+
"-webkit-border-radius: 5px",
|
85
|
+
"-moz-border-radius: 5px",
|
86
|
+
"color: #e00",
|
87
|
+
"padding: 15px",
|
88
|
+
"margin-bottom: 15px"
|
89
|
+
].join(';');
|
90
|
+
|
91
|
+
if (options.env === 'development') {
|
92
|
+
timer = setInterval(function () {
|
93
|
+
var document = window.document,
|
94
|
+
body = document.body;
|
95
|
+
if (body) {
|
96
|
+
if (document.getElementById(id)) {
|
97
|
+
body.replaceChild(elem, document.getElementById(id));
|
98
|
+
} else {
|
99
|
+
body.insertBefore(elem, body.firstChild);
|
100
|
+
}
|
101
|
+
clearInterval(timer);
|
102
|
+
}
|
103
|
+
}, 10);
|
104
|
+
}
|
105
|
+
}
|
106
|
+
|
107
|
+
function removeErrorHTML(path) {
|
108
|
+
var node = window.document.getElementById('less-error-message:' + utils.extractId(path));
|
109
|
+
if (node) {
|
110
|
+
node.parentNode.removeChild(node);
|
111
|
+
}
|
112
|
+
}
|
113
|
+
|
114
|
+
function removeErrorConsole(path) {
|
115
|
+
//no action
|
116
|
+
}
|
117
|
+
|
118
|
+
function removeError(path) {
|
119
|
+
if (!options.errorReporting || options.errorReporting === "html") {
|
120
|
+
removeErrorHTML(path);
|
121
|
+
} else if (options.errorReporting === "console") {
|
122
|
+
removeErrorConsole(path);
|
123
|
+
} else if (typeof options.errorReporting === 'function') {
|
124
|
+
options.errorReporting("remove", path);
|
125
|
+
}
|
126
|
+
}
|
127
|
+
|
128
|
+
function errorConsole(e, rootHref) {
|
129
|
+
var template = '{line} {content}';
|
130
|
+
var filename = e.filename || rootHref;
|
131
|
+
var errors = [];
|
132
|
+
var content = (e.type || "Syntax") + "Error: " + (e.message || 'There is an error in your .less file') +
|
133
|
+
" in " + filename + " ";
|
134
|
+
|
135
|
+
var errorline = function (e, i, classname) {
|
136
|
+
if (e.extract[i] !== undefined) {
|
137
|
+
errors.push(template.replace(/\{line\}/, (parseInt(e.line, 10) || 0) + (i - 1))
|
138
|
+
.replace(/\{class\}/, classname)
|
139
|
+
.replace(/\{content\}/, e.extract[i]));
|
140
|
+
}
|
141
|
+
};
|
142
|
+
|
143
|
+
if (e.extract) {
|
144
|
+
errorline(e, 0, '');
|
145
|
+
errorline(e, 1, 'line');
|
146
|
+
errorline(e, 2, '');
|
147
|
+
content += 'on line ' + e.line + ', column ' + (e.column + 1) + ':\n' +
|
148
|
+
errors.join('\n');
|
149
|
+
}
|
150
|
+
if (e.stack && (e.extract || options.logLevel >= 4)) {
|
151
|
+
content += '\nStack Trace\n' + e.stack;
|
152
|
+
}
|
153
|
+
less.logger.error(content);
|
154
|
+
}
|
155
|
+
|
156
|
+
function error(e, rootHref) {
|
157
|
+
if (!options.errorReporting || options.errorReporting === "html") {
|
158
|
+
errorHTML(e, rootHref);
|
159
|
+
} else if (options.errorReporting === "console") {
|
160
|
+
errorConsole(e, rootHref);
|
161
|
+
} else if (typeof options.errorReporting === 'function') {
|
162
|
+
options.errorReporting("add", e, rootHref);
|
163
|
+
}
|
164
|
+
}
|
165
|
+
|
166
|
+
return {
|
167
|
+
add: error,
|
168
|
+
remove: removeError
|
169
|
+
};
|
170
|
+
};
|
@@ -0,0 +1,119 @@
|
|
1
|
+
/*global window, XMLHttpRequest */
|
2
|
+
|
3
|
+
module.exports = function(options, logger) {
|
4
|
+
|
5
|
+
var AbstractFileManager = require("../less/environment/abstract-file-manager.js");
|
6
|
+
|
7
|
+
var fileCache = {};
|
8
|
+
|
9
|
+
//TODOS - move log somewhere. pathDiff and doing something similar in node. use pathDiff in the other browser file for the initial load
|
10
|
+
|
11
|
+
function getXMLHttpRequest() {
|
12
|
+
if (window.XMLHttpRequest && (window.location.protocol !== "file:" || !("ActiveXObject" in window))) {
|
13
|
+
return new XMLHttpRequest();
|
14
|
+
} else {
|
15
|
+
try {
|
16
|
+
/*global ActiveXObject */
|
17
|
+
return new ActiveXObject("Microsoft.XMLHTTP");
|
18
|
+
} catch (e) {
|
19
|
+
logger.error("browser doesn't support AJAX.");
|
20
|
+
return null;
|
21
|
+
}
|
22
|
+
}
|
23
|
+
}
|
24
|
+
|
25
|
+
var FileManager = function() {
|
26
|
+
};
|
27
|
+
|
28
|
+
FileManager.prototype = new AbstractFileManager();
|
29
|
+
|
30
|
+
FileManager.prototype.alwaysMakePathsAbsolute = function alwaysMakePathsAbsolute() {
|
31
|
+
return true;
|
32
|
+
};
|
33
|
+
FileManager.prototype.join = function join(basePath, laterPath) {
|
34
|
+
if (!basePath) {
|
35
|
+
return laterPath;
|
36
|
+
}
|
37
|
+
return this.extractUrlParts(laterPath, basePath).path;
|
38
|
+
};
|
39
|
+
FileManager.prototype.doXHR = function doXHR(url, type, callback, errback) {
|
40
|
+
|
41
|
+
var xhr = getXMLHttpRequest();
|
42
|
+
var async = options.isFileProtocol ? options.fileAsync : true;
|
43
|
+
|
44
|
+
if (typeof xhr.overrideMimeType === 'function') {
|
45
|
+
xhr.overrideMimeType('text/css');
|
46
|
+
}
|
47
|
+
logger.debug("XHR: Getting '" + url + "'");
|
48
|
+
xhr.open('GET', url, async);
|
49
|
+
xhr.setRequestHeader('Accept', type || 'text/x-less, text/css; q=0.9, */*; q=0.5');
|
50
|
+
xhr.send(null);
|
51
|
+
|
52
|
+
function handleResponse(xhr, callback, errback) {
|
53
|
+
if (xhr.status >= 200 && xhr.status < 300) {
|
54
|
+
callback(xhr.responseText,
|
55
|
+
xhr.getResponseHeader("Last-Modified"));
|
56
|
+
} else if (typeof errback === 'function') {
|
57
|
+
errback(xhr.status, url);
|
58
|
+
}
|
59
|
+
}
|
60
|
+
|
61
|
+
if (options.isFileProtocol && !options.fileAsync) {
|
62
|
+
if (xhr.status === 0 || (xhr.status >= 200 && xhr.status < 300)) {
|
63
|
+
callback(xhr.responseText);
|
64
|
+
} else {
|
65
|
+
errback(xhr.status, url);
|
66
|
+
}
|
67
|
+
} else if (async) {
|
68
|
+
xhr.onreadystatechange = function () {
|
69
|
+
if (xhr.readyState == 4) {
|
70
|
+
handleResponse(xhr, callback, errback);
|
71
|
+
}
|
72
|
+
};
|
73
|
+
} else {
|
74
|
+
handleResponse(xhr, callback, errback);
|
75
|
+
}
|
76
|
+
};
|
77
|
+
FileManager.prototype.supports = function(filename, currentDirectory, options, environment) {
|
78
|
+
return true;
|
79
|
+
};
|
80
|
+
|
81
|
+
FileManager.prototype.clearFileCache = function() {
|
82
|
+
fileCache = {};
|
83
|
+
};
|
84
|
+
|
85
|
+
FileManager.prototype.loadFile = function loadFile(filename, currentDirectory, options, environment, callback) {
|
86
|
+
if (currentDirectory && !this.isPathAbsolute(filename)) {
|
87
|
+
filename = currentDirectory + filename;
|
88
|
+
}
|
89
|
+
|
90
|
+
options = options || {};
|
91
|
+
|
92
|
+
// sheet may be set to the stylesheet for the initial load or a collection of properties including
|
93
|
+
// some context variables for imports
|
94
|
+
var hrefParts = this.extractUrlParts(filename, window.location.href);
|
95
|
+
var href = hrefParts.url;
|
96
|
+
|
97
|
+
if (options.useFileCache && fileCache[href]) {
|
98
|
+
try {
|
99
|
+
var lessText = fileCache[href];
|
100
|
+
callback(null, { contents: lessText, filename: href, webInfo: { lastModified: new Date() }});
|
101
|
+
} catch (e) {
|
102
|
+
callback({filename: href, message: "Error loading file " + href + " error was " + e.message});
|
103
|
+
}
|
104
|
+
return;
|
105
|
+
}
|
106
|
+
|
107
|
+
this.doXHR(href, options.mime, function doXHRCallback(data, lastModified) {
|
108
|
+
// per file cache
|
109
|
+
fileCache[href] = data;
|
110
|
+
|
111
|
+
// Use remote copy (re-parse)
|
112
|
+
callback(null, { contents: data, filename: href, webInfo: { lastModified: lastModified }});
|
113
|
+
}, function doXHRError(status, url) {
|
114
|
+
callback({ type: 'File', message: "'" + url + "' wasn't found (" + status + ")", href: href });
|
115
|
+
});
|
116
|
+
};
|
117
|
+
|
118
|
+
return FileManager;
|
119
|
+
};
|
@@ -0,0 +1,28 @@
|
|
1
|
+
module.exports = function() {
|
2
|
+
|
3
|
+
var functionRegistry = require("./../less/functions/function-registry");
|
4
|
+
|
5
|
+
function imageSize() {
|
6
|
+
throw {
|
7
|
+
type: "Runtime",
|
8
|
+
message: "Image size functions are not supported in browser version of less"
|
9
|
+
};
|
10
|
+
}
|
11
|
+
|
12
|
+
var imageFunctions = {
|
13
|
+
"image-size": function(filePathNode) {
|
14
|
+
imageSize(this, filePathNode);
|
15
|
+
return -1;
|
16
|
+
},
|
17
|
+
"image-width": function(filePathNode) {
|
18
|
+
imageSize(this, filePathNode);
|
19
|
+
return -1;
|
20
|
+
},
|
21
|
+
"image-height": function(filePathNode) {
|
22
|
+
imageSize(this, filePathNode);
|
23
|
+
return -1;
|
24
|
+
}
|
25
|
+
};
|
26
|
+
|
27
|
+
functionRegistry.addMultiple(imageFunctions);
|
28
|
+
};
|
@@ -0,0 +1,263 @@
|
|
1
|
+
//
|
2
|
+
// index.js
|
3
|
+
// Should expose the additional browser functions on to the less object
|
4
|
+
//
|
5
|
+
var addDataAttr = require("./utils").addDataAttr,
|
6
|
+
browser = require("./browser");
|
7
|
+
|
8
|
+
module.exports = function(window, options) {
|
9
|
+
var document = window.document;
|
10
|
+
var less = require('../less')();
|
11
|
+
|
12
|
+
//module.exports = less;
|
13
|
+
less.options = options;
|
14
|
+
var environment = less.environment,
|
15
|
+
FileManager = require("./file-manager")(options, less.logger),
|
16
|
+
fileManager = new FileManager();
|
17
|
+
environment.addFileManager(fileManager);
|
18
|
+
less.FileManager = FileManager;
|
19
|
+
|
20
|
+
require("./log-listener")(less, options);
|
21
|
+
var errors = require("./error-reporting")(window, less, options);
|
22
|
+
var cache = less.cache = options.cache || require("./cache")(window, options, less.logger);
|
23
|
+
require('./image-size')(less.environment);
|
24
|
+
|
25
|
+
//Setup user functions
|
26
|
+
if (options.functions) {
|
27
|
+
less.functions.functionRegistry.addMultiple(options.functions);
|
28
|
+
}
|
29
|
+
|
30
|
+
var typePattern = /^text\/(x-)?less$/;
|
31
|
+
|
32
|
+
function postProcessCSS(styles) { // deprecated, use a plugin for postprocesstasks
|
33
|
+
if (options.postProcessor && typeof options.postProcessor === 'function') {
|
34
|
+
styles = options.postProcessor.call(styles, styles) || styles;
|
35
|
+
}
|
36
|
+
return styles;
|
37
|
+
}
|
38
|
+
|
39
|
+
function clone(obj) {
|
40
|
+
var cloned = {};
|
41
|
+
for (var prop in obj) {
|
42
|
+
if (obj.hasOwnProperty(prop)) {
|
43
|
+
cloned[prop] = obj[prop];
|
44
|
+
}
|
45
|
+
}
|
46
|
+
return cloned;
|
47
|
+
}
|
48
|
+
|
49
|
+
// only really needed for phantom
|
50
|
+
function bind(func, thisArg) {
|
51
|
+
var curryArgs = Array.prototype.slice.call(arguments, 2);
|
52
|
+
return function() {
|
53
|
+
var args = curryArgs.concat(Array.prototype.slice.call(arguments, 0));
|
54
|
+
return func.apply(thisArg, args);
|
55
|
+
};
|
56
|
+
}
|
57
|
+
|
58
|
+
function loadStyles(modifyVars) {
|
59
|
+
var styles = document.getElementsByTagName('style'),
|
60
|
+
style;
|
61
|
+
|
62
|
+
for (var i = 0; i < styles.length; i++) {
|
63
|
+
style = styles[i];
|
64
|
+
if (style.type.match(typePattern)) {
|
65
|
+
var instanceOptions = clone(options);
|
66
|
+
instanceOptions.modifyVars = modifyVars;
|
67
|
+
var lessText = style.innerHTML || '';
|
68
|
+
instanceOptions.filename = document.location.href.replace(/#.*$/, '');
|
69
|
+
|
70
|
+
/*jshint loopfunc:true */
|
71
|
+
// use closure to store current style
|
72
|
+
less.render(lessText, instanceOptions,
|
73
|
+
bind(function(style, e, result) {
|
74
|
+
if (e) {
|
75
|
+
errors.add(e, "inline");
|
76
|
+
} else {
|
77
|
+
style.type = 'text/css';
|
78
|
+
if (style.styleSheet) {
|
79
|
+
style.styleSheet.cssText = result.css;
|
80
|
+
} else {
|
81
|
+
style.innerHTML = result.css;
|
82
|
+
}
|
83
|
+
}
|
84
|
+
}, null, style));
|
85
|
+
}
|
86
|
+
}
|
87
|
+
}
|
88
|
+
|
89
|
+
function loadStyleSheet(sheet, callback, reload, remaining, modifyVars) {
|
90
|
+
|
91
|
+
var instanceOptions = clone(options);
|
92
|
+
addDataAttr(instanceOptions, sheet);
|
93
|
+
instanceOptions.mime = sheet.type;
|
94
|
+
|
95
|
+
if (modifyVars) {
|
96
|
+
instanceOptions.modifyVars = modifyVars;
|
97
|
+
}
|
98
|
+
|
99
|
+
function loadInitialFileCallback(loadedFile) {
|
100
|
+
|
101
|
+
var data = loadedFile.contents,
|
102
|
+
path = loadedFile.filename,
|
103
|
+
webInfo = loadedFile.webInfo;
|
104
|
+
|
105
|
+
var newFileInfo = {
|
106
|
+
currentDirectory: fileManager.getPath(path),
|
107
|
+
filename: path,
|
108
|
+
rootFilename: path,
|
109
|
+
relativeUrls: instanceOptions.relativeUrls};
|
110
|
+
|
111
|
+
newFileInfo.entryPath = newFileInfo.currentDirectory;
|
112
|
+
newFileInfo.rootpath = instanceOptions.rootpath || newFileInfo.currentDirectory;
|
113
|
+
|
114
|
+
if (webInfo) {
|
115
|
+
webInfo.remaining = remaining;
|
116
|
+
|
117
|
+
var css = cache.getCSS(path, webInfo, instanceOptions.modifyVars);
|
118
|
+
if (!reload && css) {
|
119
|
+
webInfo.local = true;
|
120
|
+
callback(null, css, data, sheet, webInfo, path);
|
121
|
+
return;
|
122
|
+
}
|
123
|
+
|
124
|
+
}
|
125
|
+
|
126
|
+
//TODO add tests around how this behaves when reloading
|
127
|
+
errors.remove(path);
|
128
|
+
|
129
|
+
instanceOptions.rootFileInfo = newFileInfo;
|
130
|
+
less.render(data, instanceOptions, function(e, result) {
|
131
|
+
if (e) {
|
132
|
+
e.href = path;
|
133
|
+
callback(e);
|
134
|
+
} else {
|
135
|
+
result.css = postProcessCSS(result.css);
|
136
|
+
cache.setCSS(sheet.href, webInfo.lastModified, instanceOptions.modifyVars, result.css);
|
137
|
+
callback(null, result.css, data, sheet, webInfo, path);
|
138
|
+
}
|
139
|
+
});
|
140
|
+
}
|
141
|
+
|
142
|
+
fileManager.loadFile(sheet.href, null, instanceOptions, environment, function(e, loadedFile) {
|
143
|
+
if (e) {
|
144
|
+
callback(e);
|
145
|
+
return;
|
146
|
+
}
|
147
|
+
loadInitialFileCallback(loadedFile);
|
148
|
+
});
|
149
|
+
}
|
150
|
+
|
151
|
+
function loadStyleSheets(callback, reload, modifyVars) {
|
152
|
+
for (var i = 0; i < less.sheets.length; i++) {
|
153
|
+
loadStyleSheet(less.sheets[i], callback, reload, less.sheets.length - (i + 1), modifyVars);
|
154
|
+
}
|
155
|
+
}
|
156
|
+
|
157
|
+
function initRunningMode() {
|
158
|
+
if (less.env === 'development') {
|
159
|
+
less.watchTimer = setInterval(function () {
|
160
|
+
if (less.watchMode) {
|
161
|
+
fileManager.clearFileCache();
|
162
|
+
loadStyleSheets(function (e, css, _, sheet, webInfo) {
|
163
|
+
if (e) {
|
164
|
+
errors.add(e, e.href || sheet.href);
|
165
|
+
} else if (css) {
|
166
|
+
browser.createCSS(window.document, css, sheet);
|
167
|
+
}
|
168
|
+
});
|
169
|
+
}
|
170
|
+
}, options.poll);
|
171
|
+
}
|
172
|
+
}
|
173
|
+
|
174
|
+
//
|
175
|
+
// Watch mode
|
176
|
+
//
|
177
|
+
less.watch = function () {
|
178
|
+
if (!less.watchMode ) {
|
179
|
+
less.env = 'development';
|
180
|
+
initRunningMode();
|
181
|
+
}
|
182
|
+
this.watchMode = true;
|
183
|
+
return true;
|
184
|
+
};
|
185
|
+
|
186
|
+
less.unwatch = function () {clearInterval(less.watchTimer); this.watchMode = false; return false; };
|
187
|
+
|
188
|
+
//
|
189
|
+
// Synchronously get all <link> tags with the 'rel' attribute set to
|
190
|
+
// "stylesheet/less".
|
191
|
+
//
|
192
|
+
less.registerStylesheetsImmediately = function() {
|
193
|
+
var links = document.getElementsByTagName('link');
|
194
|
+
less.sheets = [];
|
195
|
+
|
196
|
+
for (var i = 0; i < links.length; i++) {
|
197
|
+
if (links[i].rel === 'stylesheet/less' || (links[i].rel.match(/stylesheet/) &&
|
198
|
+
(links[i].type.match(typePattern)))) {
|
199
|
+
less.sheets.push(links[i]);
|
200
|
+
}
|
201
|
+
}
|
202
|
+
};
|
203
|
+
|
204
|
+
//
|
205
|
+
// Asynchronously get all <link> tags with the 'rel' attribute set to
|
206
|
+
// "stylesheet/less", returning a Promise.
|
207
|
+
//
|
208
|
+
less.registerStylesheets = function() {
|
209
|
+
return new Promise(function(resolve, reject) {
|
210
|
+
less.registerStylesheetsImmediately();
|
211
|
+
resolve();
|
212
|
+
});
|
213
|
+
};
|
214
|
+
|
215
|
+
//
|
216
|
+
// With this function, it's possible to alter variables and re-render
|
217
|
+
// CSS without reloading less-files
|
218
|
+
//
|
219
|
+
less.modifyVars = function(record) {
|
220
|
+
return less.refresh(true, record, false);
|
221
|
+
};
|
222
|
+
|
223
|
+
less.refresh = function (reload, modifyVars, clearFileCache) {
|
224
|
+
if ((reload || clearFileCache) && clearFileCache !== false) {
|
225
|
+
fileManager.clearFileCache();
|
226
|
+
}
|
227
|
+
return new Promise(function (resolve, reject) {
|
228
|
+
var startTime, endTime, totalMilliseconds;
|
229
|
+
startTime = endTime = new Date();
|
230
|
+
|
231
|
+
loadStyleSheets(function (e, css, _, sheet, webInfo) {
|
232
|
+
if (e) {
|
233
|
+
errors.add(e, e.href || sheet.href);
|
234
|
+
reject(e);
|
235
|
+
return;
|
236
|
+
}
|
237
|
+
if (webInfo.local) {
|
238
|
+
less.logger.info("loading " + sheet.href + " from cache.");
|
239
|
+
} else {
|
240
|
+
less.logger.info("rendered " + sheet.href + " successfully.");
|
241
|
+
}
|
242
|
+
browser.createCSS(window.document, css, sheet);
|
243
|
+
less.logger.info("css for " + sheet.href + " generated in " + (new Date() - endTime) + 'ms');
|
244
|
+
if (webInfo.remaining === 0) {
|
245
|
+
totalMilliseconds = new Date() - startTime;
|
246
|
+
less.logger.info("less has finished. css generated in " + totalMilliseconds + 'ms');
|
247
|
+
resolve({
|
248
|
+
startTime: startTime,
|
249
|
+
endTime: endTime,
|
250
|
+
totalMilliseconds: totalMilliseconds,
|
251
|
+
sheets: less.sheets.length
|
252
|
+
});
|
253
|
+
}
|
254
|
+
endTime = new Date();
|
255
|
+
}, reload, modifyVars);
|
256
|
+
|
257
|
+
loadStyles(modifyVars);
|
258
|
+
});
|
259
|
+
};
|
260
|
+
|
261
|
+
less.refreshStyles = loadStyles;
|
262
|
+
return less;
|
263
|
+
};
|