less 2.2.2 → 2.6.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (441) hide show
  1. checksums.yaml +7 -0
  2. data/Changelog.md +17 -0
  3. data/Gemfile +7 -3
  4. data/README.md +29 -13
  5. data/bin/lessc +3 -1
  6. data/less.gemspec +2 -6
  7. data/lib/less/defaults.rb +3 -3
  8. data/lib/less/java_script/rhino_context.rb +17 -27
  9. data/lib/less/java_script/v8_context.rb +11 -11
  10. data/lib/less/js/.gitattributes +10 -0
  11. data/lib/less/js/.gitignore +24 -0
  12. data/lib/less/js/.jshintrc +11 -0
  13. data/lib/less/js/.npmignore +1 -0
  14. data/lib/less/js/.travis.yml +8 -0
  15. data/lib/less/js/CHANGELOG.md +299 -0
  16. data/lib/less/js/CONTRIBUTING.md +50 -0
  17. data/lib/less/js/Gruntfile.js +298 -0
  18. data/lib/less/js/README.md +43 -12
  19. data/lib/less/js/benchmark/benchmark.less +194 -194
  20. data/lib/less/js/benchmark/less-benchmark.js +9 -10
  21. data/lib/less/js/bin/lessc +310 -37
  22. data/lib/less/js/bower.json +18 -0
  23. data/lib/less/js/build/README.md +51 -0
  24. data/lib/less/js/build/amd.js +1 -1
  25. data/lib/less/js/build/browser-header.js +4 -0
  26. data/lib/less/js/build/build.yml +162 -0
  27. data/lib/less/js/build/require-rhino.js +7 -2
  28. data/lib/less/js/build/rhino-header.js +4 -0
  29. data/lib/less/js/build/rhino-modules.js +131 -0
  30. data/lib/less/js/build/tasks/.gitkeep +1 -0
  31. data/lib/less/js/build.gradle +347 -0
  32. data/lib/less/js/dist/less-1.3.1.js +4011 -0
  33. data/lib/less/js/dist/less-1.3.1.min.js +9 -0
  34. data/lib/less/js/dist/less-1.3.2.js +4401 -0
  35. data/lib/less/js/dist/less-1.3.2.min.js +9 -0
  36. data/lib/less/js/dist/less-1.3.3.js +4413 -0
  37. data/lib/less/js/dist/less-1.3.3.min.js +9 -0
  38. data/lib/less/js/dist/less-1.4.0-beta.js +5830 -0
  39. data/lib/less/js/dist/less-1.4.0-beta.min.js +11 -0
  40. data/lib/less/js/dist/less-1.4.0.js +5830 -0
  41. data/lib/less/js/dist/less-1.4.0.min.js +11 -0
  42. data/lib/less/js/dist/less-1.4.1.js +5837 -0
  43. data/lib/less/js/dist/less-1.4.1.min.js +11 -0
  44. data/lib/less/js/dist/less-1.4.2.js +5837 -0
  45. data/lib/less/js/dist/less-1.4.2.min.js +11 -0
  46. data/lib/less/js/dist/less-1.5.0.js +6914 -0
  47. data/lib/less/js/dist/less-1.5.0.min.js +13 -0
  48. data/lib/less/js/dist/less-1.5.1.js +6941 -0
  49. data/lib/less/js/dist/less-1.5.1.min.js +13 -0
  50. data/lib/less/js/dist/less-1.6.0.js +7485 -0
  51. data/lib/less/js/dist/less-1.6.0.min.js +16 -0
  52. data/lib/less/js/dist/less-1.6.1.js +7513 -0
  53. data/lib/less/js/dist/less-1.6.1.min.js +16 -0
  54. data/lib/less/js/dist/less-1.6.2.js +7624 -0
  55. data/lib/less/js/dist/less-1.6.2.min.js +16 -0
  56. data/lib/less/js/dist/less-1.6.3.js +7627 -0
  57. data/lib/less/js/dist/less-1.6.3.min.js +16 -0
  58. data/lib/less/js/dist/less-1.7.0.js +7921 -0
  59. data/lib/less/js/dist/less-1.7.0.min.js +16 -0
  60. data/lib/less/js/dist/less-rhino-1.3.1.js +3725 -0
  61. data/lib/less/js/dist/less-rhino-1.3.2.js +3990 -0
  62. data/lib/less/js/dist/less-rhino-1.3.3.js +4002 -0
  63. data/lib/less/js/dist/less-rhino-1.4.0.js +4273 -0
  64. data/lib/less/js/dist/less-rhino-1.5.1.js +6831 -0
  65. data/lib/less/js/dist/less-rhino-1.6.2.js +9017 -0
  66. data/lib/less/js/dist/less-rhino-1.6.3.js +9020 -0
  67. data/lib/less/js/dist/less-rhino-1.7.0.js +9301 -0
  68. data/lib/less/js/dist/lessc-rhino-1.6.2.js +449 -0
  69. data/lib/less/js/dist/lessc-rhino-1.6.3.js +449 -0
  70. data/lib/less/js/dist/lessc-rhino-1.7.0.js +449 -0
  71. data/lib/less/js/gradle/wrapper/gradle-wrapper.jar +0 -0
  72. data/lib/less/js/gradle/wrapper/gradle-wrapper.properties +6 -0
  73. data/lib/less/js/gradlew +164 -0
  74. data/lib/less/js/gradlew.bat +90 -0
  75. data/lib/less/js/lib/less/browser.js +547 -250
  76. data/lib/less/js/lib/less/encoder.js +4 -0
  77. data/lib/less/js/lib/less/env.js +136 -0
  78. data/lib/less/js/lib/less/extend-visitor.js +416 -0
  79. data/lib/less/js/lib/less/functions.js +576 -36
  80. data/lib/less/js/lib/less/import-visitor.js +142 -0
  81. data/lib/less/js/lib/less/index.js +187 -83
  82. data/lib/less/js/lib/less/join-selector-visitor.js +44 -0
  83. data/lib/less/js/lib/less/lessc_helper.js +82 -0
  84. data/lib/less/js/lib/less/parser.js +1286 -523
  85. data/lib/less/js/lib/less/rhino.js +415 -29
  86. data/lib/less/js/lib/less/source-map-output.js +141 -0
  87. data/lib/less/js/lib/less/to-css-visitor.js +240 -0
  88. data/lib/less/js/lib/less/tree/alpha.js +17 -5
  89. data/lib/less/js/lib/less/tree/anonymous.js +25 -4
  90. data/lib/less/js/lib/less/tree/assignment.js +17 -5
  91. data/lib/less/js/lib/less/tree/call.js +36 -13
  92. data/lib/less/js/lib/less/tree/color.js +119 -31
  93. data/lib/less/js/lib/less/tree/comment.js +18 -4
  94. data/lib/less/js/lib/less/tree/condition.js +35 -28
  95. data/lib/less/js/lib/less/tree/detached-ruleset.js +20 -0
  96. data/lib/less/js/lib/less/tree/dimension.js +291 -16
  97. data/lib/less/js/lib/less/tree/directive.js +56 -22
  98. data/lib/less/js/lib/less/tree/element.js +78 -17
  99. data/lib/less/js/lib/less/tree/expression.js +39 -8
  100. data/lib/less/js/lib/less/tree/extend.js +53 -0
  101. data/lib/less/js/lib/less/tree/import.js +81 -36
  102. data/lib/less/js/lib/less/tree/javascript.js +17 -10
  103. data/lib/less/js/lib/less/tree/keyword.js +8 -3
  104. data/lib/less/js/lib/less/tree/media.js +70 -27
  105. data/lib/less/js/lib/less/tree/mixin.js +250 -70
  106. data/lib/less/js/lib/less/tree/negative.js +24 -0
  107. data/lib/less/js/lib/less/tree/operation.js +38 -13
  108. data/lib/less/js/lib/less/tree/paren.js +9 -2
  109. data/lib/less/js/lib/less/tree/quoted.js +29 -10
  110. data/lib/less/js/lib/less/tree/rule.js +77 -29
  111. data/lib/less/js/lib/less/tree/ruleset-call.js +16 -0
  112. data/lib/less/js/lib/less/tree/ruleset.js +445 -107
  113. data/lib/less/js/lib/less/tree/selector.js +117 -30
  114. data/lib/less/js/lib/less/tree/unicode-descriptor.js +15 -0
  115. data/lib/less/js/lib/less/tree/url.js +43 -15
  116. data/lib/less/js/lib/less/tree/value.js +16 -6
  117. data/lib/less/js/lib/less/tree/variable.js +26 -8
  118. data/lib/less/js/lib/less/tree.js +82 -2
  119. data/lib/less/js/lib/less/visitor.js +146 -0
  120. data/lib/less/js/lib/source-map/source-map-0.1.31.js +1933 -0
  121. data/lib/less/js/lib/source-map/source-map-footer.js +4 -0
  122. data/lib/less/js/lib/source-map/source-map-header.js +3 -0
  123. data/lib/less/js/package.json +86 -11
  124. data/lib/less/js/test/browser/common.js +201 -0
  125. data/lib/less/js/test/browser/css/global-vars/simple.css +3 -0
  126. data/lib/less/js/test/browser/css/modify-vars/simple.css +8 -0
  127. data/lib/less/js/test/browser/css/postProcessor/postProcessor.css +4 -0
  128. data/lib/less/js/test/browser/css/relative-urls/urls.css +35 -0
  129. data/lib/less/js/test/browser/css/rootpath/urls.css +35 -0
  130. data/lib/less/js/test/browser/css/rootpath-relative/urls.css +35 -0
  131. data/lib/less/js/test/browser/css/urls.css +53 -0
  132. data/lib/less/js/test/browser/es5.js +27 -0
  133. data/lib/less/js/test/browser/jasmine-html.js +681 -0
  134. data/lib/less/js/test/browser/jasmine.css +82 -0
  135. data/lib/less/js/test/browser/jasmine.js +2600 -0
  136. data/lib/less/js/test/browser/less/console-errors/test-error.less +3 -0
  137. data/lib/less/js/test/browser/less/console-errors/test-error.txt +2 -0
  138. data/lib/less/js/test/browser/less/global-vars/simple.less +3 -0
  139. data/lib/less/js/test/browser/less/imports/urls.less +4 -0
  140. data/lib/less/js/test/browser/less/imports/urls2.less +4 -0
  141. data/lib/less/js/test/browser/less/modify-vars/imports/simple2.less +4 -0
  142. data/lib/less/js/test/browser/less/modify-vars/simple.less +8 -0
  143. data/lib/less/js/test/browser/less/postProcessor/postProcessor.less +4 -0
  144. data/lib/less/js/test/browser/less/relative-urls/urls.less +33 -0
  145. data/lib/less/js/test/browser/less/rootpath/urls.less +33 -0
  146. data/lib/less/js/test/browser/less/rootpath-relative/urls.less +33 -0
  147. data/lib/less/js/test/browser/less/urls.less +57 -0
  148. data/lib/less/js/test/browser/phantom-runner.js +150 -0
  149. data/lib/less/js/test/browser/runner-browser-options.js +42 -0
  150. data/lib/less/js/test/browser/runner-browser-spec.js +12 -0
  151. data/lib/less/js/test/browser/runner-console-errors.js +5 -0
  152. data/lib/less/js/test/browser/runner-errors-options.js +5 -0
  153. data/lib/less/js/test/browser/runner-errors-spec.js +4 -0
  154. data/lib/less/js/test/browser/runner-global-vars-options.js +4 -0
  155. data/lib/less/js/test/browser/runner-global-vars-spec.js +3 -0
  156. data/lib/less/js/test/browser/runner-legacy-options.js +4 -0
  157. data/lib/less/js/test/browser/runner-legacy-spec.js +3 -0
  158. data/lib/less/js/test/browser/runner-main-options.js +15 -0
  159. data/lib/less/js/test/browser/runner-main-spec.js +3 -0
  160. data/lib/less/js/test/browser/runner-modify-vars-options.js +2 -0
  161. data/lib/less/js/test/browser/runner-modify-vars-spec.js +43 -0
  162. data/lib/less/js/test/browser/runner-no-js-errors-options.js +4 -0
  163. data/lib/less/js/test/browser/runner-no-js-errors-spec.js +4 -0
  164. data/lib/less/js/test/browser/runner-postProcessor-options.js +4 -0
  165. data/lib/less/js/test/browser/runner-postProcessor.js +3 -0
  166. data/lib/less/js/test/browser/runner-production-options.js +3 -0
  167. data/lib/less/js/test/browser/runner-production-spec.js +5 -0
  168. data/lib/less/js/test/browser/runner-relative-urls-options.js +3 -0
  169. data/lib/less/js/test/browser/runner-relative-urls-spec.js +3 -0
  170. data/lib/less/js/test/browser/runner-rootpath-options.js +3 -0
  171. data/lib/less/js/test/browser/runner-rootpath-relative-options.js +4 -0
  172. data/lib/less/js/test/browser/runner-rootpath-relative-spec.js +3 -0
  173. data/lib/less/js/test/browser/runner-rootpath-spec.js +3 -0
  174. data/lib/less/js/test/browser/test-runner-template.tmpl +47 -0
  175. data/lib/less/js/test/css/charsets.css +1 -0
  176. data/lib/less/js/test/css/colors.css +29 -0
  177. data/lib/less/js/test/css/comments.css +15 -2
  178. data/lib/less/js/test/css/compression/compression.css +3 -0
  179. data/lib/less/js/test/css/css-3.css +73 -2
  180. data/lib/less/js/test/css/css-escapes.css +4 -0
  181. data/lib/less/js/test/css/css-guards.css +37 -0
  182. data/lib/less/js/test/css/css.css +20 -14
  183. data/lib/less/js/test/css/debug/linenumbers-all.css +49 -0
  184. data/lib/less/js/test/css/debug/linenumbers-comments.css +40 -0
  185. data/lib/less/js/test/css/debug/linenumbers-mediaquery.css +40 -0
  186. data/lib/less/js/test/css/detached-rulesets.css +71 -0
  187. data/lib/less/js/test/css/empty.css +0 -0
  188. data/lib/less/js/test/css/extend-chaining.css +81 -0
  189. data/lib/less/js/test/css/extend-clearfix.css +19 -0
  190. data/lib/less/js/test/css/extend-exact.css +37 -0
  191. data/lib/less/js/test/css/extend-media.css +24 -0
  192. data/lib/less/js/test/css/extend-nest.css +57 -0
  193. data/lib/less/js/test/css/extend-selector.css +80 -0
  194. data/lib/less/js/test/css/extend.css +76 -0
  195. data/lib/less/js/test/css/extract-and-length.css +133 -0
  196. data/lib/less/js/test/css/functions.css +117 -2
  197. data/lib/less/js/test/css/globalVars/extended.css +12 -0
  198. data/lib/less/js/test/css/globalVars/simple.css +6 -0
  199. data/lib/less/js/test/css/ie-filters.css +7 -3
  200. data/lib/less/js/test/css/import-inline.css +5 -0
  201. data/lib/less/js/test/css/import-interpolation.css +6 -0
  202. data/lib/less/js/test/css/import-once.css +15 -0
  203. data/lib/less/js/test/css/import-reference.css +68 -0
  204. data/lib/less/js/test/css/import.css +23 -10
  205. data/lib/less/js/test/css/javascript.css +3 -2
  206. data/lib/less/js/test/css/legacy/legacy.css +7 -0
  207. data/lib/less/js/test/css/media.css +141 -1
  208. data/lib/less/js/test/css/merge.css +34 -0
  209. data/lib/less/js/test/css/mixins-args.css +41 -4
  210. data/lib/less/js/test/css/mixins-guards-default-func.css +129 -0
  211. data/lib/less/js/test/css/mixins-guards.css +24 -0
  212. data/lib/less/js/test/css/mixins-important.css +28 -0
  213. data/lib/less/js/test/css/mixins-interpolated.css +39 -0
  214. data/lib/less/js/test/css/mixins-named-args.css +27 -0
  215. data/lib/less/js/test/css/mixins-pattern.css +4 -0
  216. data/lib/less/js/test/css/mixins.css +70 -0
  217. data/lib/less/js/test/css/modifyVars/extended.css +9 -0
  218. data/lib/less/js/test/css/no-output.css +0 -0
  219. data/lib/less/js/test/css/parens.css +21 -5
  220. data/lib/less/js/test/css/property-name-interp.css +20 -0
  221. data/lib/less/js/test/css/scope.css +23 -0
  222. data/lib/less/js/test/css/selectors.css +84 -0
  223. data/lib/less/js/test/css/static-urls/urls.css +45 -0
  224. data/lib/less/js/test/css/strings.css +5 -2
  225. data/lib/less/js/test/css/url-args/urls.css +56 -0
  226. data/lib/less/js/test/css/urls.css +71 -0
  227. data/lib/less/js/test/css/variables-in-at-rules.css +18 -0
  228. data/lib/less/js/test/css/variables.css +22 -4
  229. data/lib/less/js/test/css/whitespace.css +4 -0
  230. data/lib/less/js/test/data/data-uri-fail.png +0 -0
  231. data/lib/less/js/test/data/image.jpg +1 -0
  232. data/lib/less/js/test/data/page.html +1 -0
  233. data/lib/less/js/test/index.js +45 -0
  234. data/lib/less/js/test/less/charsets.less +3 -0
  235. data/lib/less/js/test/less/colors.less +37 -4
  236. data/lib/less/js/test/less/comments.less +21 -3
  237. data/lib/less/js/test/less/compression/compression.less +36 -0
  238. data/lib/less/js/test/less/css-3.less +70 -6
  239. data/lib/less/js/test/less/css-escapes.less +6 -1
  240. data/lib/less/js/test/less/css-guards.less +102 -0
  241. data/lib/less/js/test/less/css.less +23 -15
  242. data/lib/less/js/test/less/debug/import/test.less +25 -0
  243. data/lib/less/js/test/less/debug/linenumbers.less +33 -0
  244. data/lib/less/js/test/less/detached-rulesets.less +103 -0
  245. data/lib/less/js/test/less/empty.less +0 -0
  246. data/lib/less/js/test/less/errors/add-mixed-units.less +3 -0
  247. data/lib/less/js/test/less/errors/add-mixed-units.txt +4 -0
  248. data/lib/less/js/test/less/errors/add-mixed-units2.less +3 -0
  249. data/lib/less/js/test/less/errors/add-mixed-units2.txt +4 -0
  250. data/lib/less/js/test/less/errors/at-rules-undefined-var.less +4 -0
  251. data/lib/less/js/test/less/errors/at-rules-undefined-var.txt +4 -0
  252. data/lib/less/js/test/less/errors/bad-variable-declaration1.less +1 -0
  253. data/lib/less/js/test/less/errors/bad-variable-declaration1.txt +2 -0
  254. data/lib/less/js/test/less/errors/color-func-invalid-color.less +3 -0
  255. data/lib/less/js/test/less/errors/color-func-invalid-color.txt +4 -0
  256. data/lib/less/js/test/less/errors/comment-in-selector.less +1 -0
  257. data/lib/less/js/test/less/errors/comment-in-selector.txt +2 -0
  258. data/lib/less/js/test/less/errors/css-guard-default-func.less +4 -0
  259. data/lib/less/js/test/less/errors/css-guard-default-func.txt +4 -0
  260. data/lib/less/js/test/less/errors/detached-ruleset-1.less +6 -0
  261. data/lib/less/js/test/less/errors/detached-ruleset-1.txt +4 -0
  262. data/lib/less/js/test/less/errors/detached-ruleset-2.less +6 -0
  263. data/lib/less/js/test/less/errors/detached-ruleset-2.txt +4 -0
  264. data/lib/less/js/test/less/errors/detached-ruleset-3.less +4 -0
  265. data/lib/less/js/test/less/errors/detached-ruleset-3.txt +4 -0
  266. data/lib/less/js/test/less/errors/detached-ruleset-4.less +5 -0
  267. data/lib/less/js/test/less/errors/detached-ruleset-4.txt +3 -0
  268. data/lib/less/js/test/less/errors/detached-ruleset-5.less +4 -0
  269. data/lib/less/js/test/less/errors/detached-ruleset-5.txt +3 -0
  270. data/lib/less/js/test/less/errors/detached-ruleset-6.less +5 -0
  271. data/lib/less/js/test/less/errors/detached-ruleset-6.txt +4 -0
  272. data/lib/less/js/test/less/errors/divide-mixed-units.less +3 -0
  273. data/lib/less/js/test/less/errors/divide-mixed-units.txt +4 -0
  274. data/lib/less/js/test/less/errors/extend-no-selector.less +3 -0
  275. data/lib/less/js/test/less/errors/extend-no-selector.txt +3 -0
  276. data/lib/less/js/test/less/errors/extend-not-at-end.less +3 -0
  277. data/lib/less/js/test/less/errors/extend-not-at-end.txt +3 -0
  278. data/lib/less/js/test/less/errors/import-missing.less +6 -0
  279. data/lib/less/js/test/less/errors/import-missing.txt +3 -0
  280. data/lib/less/js/test/less/errors/import-no-semi.less +1 -0
  281. data/lib/less/js/test/less/errors/import-no-semi.txt +2 -0
  282. data/lib/less/js/test/less/errors/import-subfolder1.less +1 -0
  283. data/lib/less/js/test/less/errors/import-subfolder1.txt +3 -0
  284. data/lib/less/js/test/less/errors/import-subfolder2.less +1 -0
  285. data/lib/less/js/test/less/errors/import-subfolder2.txt +4 -0
  286. data/lib/less/js/test/less/errors/imports/import-subfolder1.less +1 -0
  287. data/lib/less/js/test/less/errors/imports/import-subfolder2.less +1 -0
  288. data/lib/less/js/test/less/errors/imports/import-test.less +4 -0
  289. data/lib/less/js/test/less/errors/imports/subfolder/mixin-not-defined.less +1 -0
  290. data/lib/less/js/test/less/errors/imports/subfolder/parse-error-curly-bracket.less +1 -0
  291. data/lib/less/js/test/less/errors/javascript-error.less +3 -0
  292. data/lib/less/js/test/less/errors/javascript-error.txt +4 -0
  293. data/lib/less/js/test/less/errors/javascript-undefined-var.less +3 -0
  294. data/lib/less/js/test/less/errors/javascript-undefined-var.txt +4 -0
  295. data/lib/less/js/test/less/errors/mixed-mixin-definition-args-1.less +6 -0
  296. data/lib/less/js/test/less/errors/mixed-mixin-definition-args-1.txt +4 -0
  297. data/lib/less/js/test/less/errors/mixed-mixin-definition-args-2.less +6 -0
  298. data/lib/less/js/test/less/errors/mixed-mixin-definition-args-2.txt +4 -0
  299. data/lib/less/js/test/less/errors/mixin-not-defined.less +11 -0
  300. data/lib/less/js/test/less/errors/mixin-not-defined.txt +3 -0
  301. data/lib/less/js/test/less/errors/mixin-not-matched.less +6 -0
  302. data/lib/less/js/test/less/errors/mixin-not-matched.txt +3 -0
  303. data/lib/less/js/test/less/errors/mixin-not-matched2.less +6 -0
  304. data/lib/less/js/test/less/errors/mixin-not-matched2.txt +3 -0
  305. data/lib/less/js/test/less/errors/mixin-not-visible-in-scope-1.less +9 -0
  306. data/lib/less/js/test/less/errors/mixin-not-visible-in-scope-1.txt +4 -0
  307. data/lib/less/js/test/less/errors/mixins-guards-default-func-1.less +9 -0
  308. data/lib/less/js/test/less/errors/mixins-guards-default-func-1.txt +4 -0
  309. data/lib/less/js/test/less/errors/mixins-guards-default-func-2.less +9 -0
  310. data/lib/less/js/test/less/errors/mixins-guards-default-func-2.txt +4 -0
  311. data/lib/less/js/test/less/errors/mixins-guards-default-func-3.less +9 -0
  312. data/lib/less/js/test/less/errors/mixins-guards-default-func-3.txt +4 -0
  313. data/lib/less/js/test/less/errors/multiple-guards-on-css-selectors.less +4 -0
  314. data/lib/less/js/test/less/errors/multiple-guards-on-css-selectors.txt +4 -0
  315. data/lib/less/js/test/less/errors/multiple-guards-on-css-selectors2.less +4 -0
  316. data/lib/less/js/test/less/errors/multiple-guards-on-css-selectors2.txt +4 -0
  317. data/lib/less/js/test/less/errors/multiply-mixed-units.less +7 -0
  318. data/lib/less/js/test/less/errors/multiply-mixed-units.txt +4 -0
  319. data/lib/less/js/test/less/errors/parens-error-1.less +3 -0
  320. data/lib/less/js/test/less/errors/parens-error-1.txt +4 -0
  321. data/lib/less/js/test/less/errors/parens-error-2.less +3 -0
  322. data/lib/less/js/test/less/errors/parens-error-2.txt +4 -0
  323. data/lib/less/js/test/less/errors/parens-error-3.less +3 -0
  324. data/lib/less/js/test/less/errors/parens-error-3.txt +4 -0
  325. data/lib/less/js/test/less/errors/parse-error-curly-bracket.less +4 -0
  326. data/lib/less/js/test/less/errors/parse-error-curly-bracket.txt +4 -0
  327. data/lib/less/js/test/less/errors/parse-error-extra-parens.less +5 -0
  328. data/lib/less/js/test/less/errors/parse-error-extra-parens.txt +3 -0
  329. data/lib/less/js/test/less/errors/parse-error-missing-bracket.less +2 -0
  330. data/lib/less/js/test/less/errors/parse-error-missing-bracket.txt +3 -0
  331. data/lib/less/js/test/less/errors/parse-error-missing-parens.less +5 -0
  332. data/lib/less/js/test/less/errors/parse-error-missing-parens.txt +3 -0
  333. data/lib/less/js/test/less/errors/parse-error-with-import.less +13 -0
  334. data/lib/less/js/test/less/errors/parse-error-with-import.txt +4 -0
  335. data/lib/less/js/test/less/errors/percentage-missing-space.less +3 -0
  336. data/lib/less/js/test/less/errors/percentage-missing-space.txt +4 -0
  337. data/lib/less/js/test/less/errors/property-asterisk-only-name.less +3 -0
  338. data/lib/less/js/test/less/errors/property-asterisk-only-name.txt +4 -0
  339. data/lib/less/js/test/less/errors/property-ie5-hack.less +3 -0
  340. data/lib/less/js/test/less/errors/property-ie5-hack.txt +4 -0
  341. data/lib/less/js/test/less/errors/property-in-root.less +4 -0
  342. data/lib/less/js/test/less/errors/property-in-root.txt +4 -0
  343. data/lib/less/js/test/less/errors/property-in-root2.less +1 -0
  344. data/lib/less/js/test/less/errors/property-in-root2.txt +4 -0
  345. data/lib/less/js/test/less/errors/property-in-root3.less +4 -0
  346. data/lib/less/js/test/less/errors/property-in-root3.txt +3 -0
  347. data/lib/less/js/test/less/errors/property-interp-not-defined.less +1 -0
  348. data/lib/less/js/test/less/errors/property-interp-not-defined.txt +2 -0
  349. data/lib/less/js/test/less/errors/recursive-variable.less +1 -0
  350. data/lib/less/js/test/less/errors/recursive-variable.txt +2 -0
  351. data/lib/less/js/test/less/errors/svg-gradient1.less +3 -0
  352. data/lib/less/js/test/less/errors/svg-gradient1.txt +4 -0
  353. data/lib/less/js/test/less/errors/svg-gradient2.less +3 -0
  354. data/lib/less/js/test/less/errors/svg-gradient2.txt +4 -0
  355. data/lib/less/js/test/less/errors/svg-gradient3.less +3 -0
  356. data/lib/less/js/test/less/errors/svg-gradient3.txt +4 -0
  357. data/lib/less/js/test/less/errors/unit-function.less +3 -0
  358. data/lib/less/js/test/less/errors/unit-function.txt +4 -0
  359. data/lib/less/js/test/less/extend-chaining.less +91 -0
  360. data/lib/less/js/test/less/extend-clearfix.less +19 -0
  361. data/lib/less/js/test/less/extend-exact.less +46 -0
  362. data/lib/less/js/test/less/extend-media.less +24 -0
  363. data/lib/less/js/test/less/extend-nest.less +65 -0
  364. data/lib/less/js/test/less/extend-selector.less +99 -0
  365. data/lib/less/js/test/less/extend.less +81 -0
  366. data/lib/less/js/test/less/extract-and-length.less +133 -0
  367. data/lib/less/js/test/less/functions.less +130 -6
  368. data/lib/less/js/test/less/globalVars/extended.json +5 -0
  369. data/lib/less/js/test/less/globalVars/extended.less +10 -0
  370. data/lib/less/js/test/less/globalVars/simple.json +3 -0
  371. data/lib/less/js/test/less/globalVars/simple.less +3 -0
  372. data/lib/less/js/test/less/ie-filters.less +7 -0
  373. data/lib/less/js/test/less/import/deeper/import-once-test-a.less +1 -0
  374. data/lib/less/js/test/less/import/import-and-relative-paths-test.less +17 -0
  375. data/lib/less/js/test/less/import/import-charset-test.less +1 -0
  376. data/lib/less/js/test/less/import/import-interpolation.less +1 -0
  377. data/lib/less/js/test/less/import/import-interpolation2.less +5 -0
  378. data/lib/less/js/test/less/import/import-once-test-c.less +6 -0
  379. data/lib/less/js/test/less/import/import-reference.less +51 -0
  380. data/lib/less/js/test/less/import/import-test-a.less +1 -0
  381. data/lib/less/js/test/less/import/import-test-c.less +0 -1
  382. data/lib/less/js/test/less/import/import-test-f.less +5 -0
  383. data/lib/less/js/test/less/import/imports/font.less +8 -0
  384. data/lib/less/js/test/less/import/imports/logo.less +5 -0
  385. data/lib/less/js/test/less/import/invalid-css.less +1 -0
  386. data/lib/less/js/test/less/import/urls.less +1 -0
  387. data/lib/less/js/test/less/import-inline.less +2 -0
  388. data/lib/less/js/test/less/import-interpolation.less +8 -0
  389. data/lib/less/js/test/less/import-once.less +6 -0
  390. data/lib/less/js/test/less/import-reference.less +21 -0
  391. data/lib/less/js/test/less/import.less +13 -3
  392. data/lib/less/js/test/less/javascript.less +5 -3
  393. data/lib/less/js/test/less/legacy/legacy.less +7 -0
  394. data/lib/less/js/test/less/media.less +158 -3
  395. data/lib/less/js/test/less/merge.less +78 -0
  396. data/lib/less/js/test/less/mixins-args.less +93 -15
  397. data/lib/less/js/test/less/mixins-guards-default-func.less +195 -0
  398. data/lib/less/js/test/less/mixins-guards.less +65 -0
  399. data/lib/less/js/test/less/mixins-important.less +8 -1
  400. data/lib/less/js/test/less/mixins-interpolated.less +69 -0
  401. data/lib/less/js/test/less/mixins-named-args.less +36 -0
  402. data/lib/less/js/test/less/mixins-nested.less +2 -2
  403. data/lib/less/js/test/less/mixins-pattern.less +4 -1
  404. data/lib/less/js/test/less/mixins.less +74 -0
  405. data/lib/less/js/test/less/modifyVars/extended.json +5 -0
  406. data/lib/less/js/test/less/modifyVars/extended.less +11 -0
  407. data/lib/less/js/test/less/no-js-errors/no-js-errors.less +3 -0
  408. data/lib/less/js/test/less/no-js-errors/no-js-errors.txt +4 -0
  409. data/lib/less/js/test/less/no-output.less +2 -0
  410. data/lib/less/js/test/less/operations.less +27 -27
  411. data/lib/less/js/test/less/parens.less +24 -5
  412. data/lib/less/js/test/less/property-name-interp.less +53 -0
  413. data/lib/less/js/test/less/scope.less +73 -1
  414. data/lib/less/js/test/less/selectors.less +101 -0
  415. data/lib/less/js/test/less/sourcemaps/basic.json +3 -0
  416. data/lib/less/js/test/less/sourcemaps/basic.less +27 -0
  417. data/lib/less/js/test/less/sourcemaps/imported.css +7 -0
  418. data/lib/less/js/test/less/static-urls/urls.less +33 -0
  419. data/lib/less/js/test/less/strings.less +7 -1
  420. data/lib/less/js/test/less/url-args/urls.less +63 -0
  421. data/lib/less/js/test/less/urls.less +72 -0
  422. data/lib/less/js/test/less/variables-in-at-rules.less +20 -0
  423. data/lib/less/js/test/less/variables.less +42 -13
  424. data/lib/less/js/test/less/whitespace.less +7 -0
  425. data/lib/less/js/test/less-test.js +251 -65
  426. data/lib/less/js/test/rhino/test-header.js +15 -0
  427. data/lib/less/js/test/sourcemaps/basic.json +1 -0
  428. data/lib/less/js/test/sourcemaps/index.html +17 -0
  429. data/lib/less/loader.rb +191 -27
  430. data/lib/less/parser.rb +47 -8
  431. data/lib/less/version.rb +2 -2
  432. data/spec/less/loader_spec.rb +45 -0
  433. data/spec/less/parser_spec.rb +43 -17
  434. data/spec/less/some/some.css +0 -0
  435. data/spec/less/some/some.less +4 -0
  436. metadata +352 -57
  437. data/lib/less/js/CHANGELOG +0 -41
  438. data/lib/less/js/Makefile +0 -75
  439. data/lib/less/js/build/ecma-5.js +0 -120
  440. data/lib/less/js/build/header.js +0 -7
  441. data/lib/less/js/lib/less/cssmin.js +0 -355
data/lib/less/js/Makefile DELETED
@@ -1,75 +0,0 @@
1
- #
2
- # Run all tests
3
- #
4
- test:
5
- node test/less-test.js
6
-
7
- #
8
- # Run benchmark
9
- #
10
- benchmark:
11
- node benchmark/less-benchmark.js
12
-
13
- #
14
- # Build less.js
15
- #
16
- SRC = lib/less
17
- HEADER = build/header.js
18
- VERSION = `cat package.json | grep version \
19
- | grep -o '[0-9]\.[0-9]\.[0-9]\+'`
20
- DIST = dist/less-${VERSION}.js
21
- RHINO = dist/less-rhino-${VERSION}.js
22
- DIST_MIN = dist/less-${VERSION}.min.js
23
-
24
- less:
25
- @@mkdir -p dist
26
- @@touch ${DIST}
27
- @@cat ${HEADER} | sed s/@VERSION/${VERSION}/ > ${DIST}
28
- @@echo "(function (window, undefined) {" >> ${DIST}
29
- @@cat build/require.js\
30
- build/amd.js\
31
- build/ecma-5.js\
32
- ${SRC}/parser.js\
33
- ${SRC}/functions.js\
34
- ${SRC}/colors.js\
35
- ${SRC}/tree/*.js\
36
- ${SRC}/tree.js\
37
- ${SRC}/browser.js >> ${DIST}
38
- @@echo "})(window);" >> ${DIST}
39
- @@echo ${DIST} built.
40
-
41
- rhino:
42
- @@mkdir -p dist
43
- @@touch ${RHINO}
44
- @@cat build/require-rhino.js\
45
- build/ecma-5.js\
46
- ${SRC}/parser.js\
47
- ${SRC}/functions.js\
48
- ${SRC}/tree/*.js\
49
- ${SRC}/tree.js\
50
- ${SRC}/rhino.js > ${RHINO}
51
- @@echo ${RHINO} built.
52
-
53
- min: less
54
- @@echo minifying...
55
- @@uglifyjs ${DIST} > ${DIST_MIN}
56
- @@echo ${DIST_MIN} built.
57
-
58
- server: less
59
- cp dist/less-${VERSION}.js test/html/
60
- cd test/html && python -m SimpleHTTPServer
61
-
62
- clean:
63
- git rm dist/*
64
-
65
- dist: clean min
66
- git add dist/*
67
- git commit -a -m "(dist) build ${VERSION}"
68
- git archive master --prefix=less/ -o less-${VERSION}.tar.gz
69
- npm publish less-${VERSION}.tar.gz
70
-
71
- stable:
72
- npm tag less ${VERSION} stable
73
-
74
-
75
- .PHONY: test benchmark
@@ -1,120 +0,0 @@
1
-
2
- // ecma-5.js
3
- //
4
- // -- kriskowal Kris Kowal Copyright (C) 2009-2010 MIT License
5
- // -- tlrobinson Tom Robinson
6
- // dantman Daniel Friesen
7
-
8
- //
9
- // Array
10
- //
11
- if (!Array.isArray) {
12
- Array.isArray = function(obj) {
13
- return Object.prototype.toString.call(obj) === "[object Array]" ||
14
- (obj instanceof Array);
15
- };
16
- }
17
- if (!Array.prototype.forEach) {
18
- Array.prototype.forEach = function(block, thisObject) {
19
- var len = this.length >>> 0;
20
- for (var i = 0; i < len; i++) {
21
- if (i in this) {
22
- block.call(thisObject, this[i], i, this);
23
- }
24
- }
25
- };
26
- }
27
- if (!Array.prototype.map) {
28
- Array.prototype.map = function(fun /*, thisp*/) {
29
- var len = this.length >>> 0;
30
- var res = new Array(len);
31
- var thisp = arguments[1];
32
-
33
- for (var i = 0; i < len; i++) {
34
- if (i in this) {
35
- res[i] = fun.call(thisp, this[i], i, this);
36
- }
37
- }
38
- return res;
39
- };
40
- }
41
- if (!Array.prototype.filter) {
42
- Array.prototype.filter = function (block /*, thisp */) {
43
- var values = [];
44
- var thisp = arguments[1];
45
- for (var i = 0; i < this.length; i++) {
46
- if (block.call(thisp, this[i])) {
47
- values.push(this[i]);
48
- }
49
- }
50
- return values;
51
- };
52
- }
53
- if (!Array.prototype.reduce) {
54
- Array.prototype.reduce = function(fun /*, initial*/) {
55
- var len = this.length >>> 0;
56
- var i = 0;
57
-
58
- // no value to return if no initial value and an empty array
59
- if (len === 0 && arguments.length === 1) throw new TypeError();
60
-
61
- if (arguments.length >= 2) {
62
- var rv = arguments[1];
63
- } else {
64
- do {
65
- if (i in this) {
66
- rv = this[i++];
67
- break;
68
- }
69
- // if array contains no values, no initial value to return
70
- if (++i >= len) throw new TypeError();
71
- } while (true);
72
- }
73
- for (; i < len; i++) {
74
- if (i in this) {
75
- rv = fun.call(null, rv, this[i], i, this);
76
- }
77
- }
78
- return rv;
79
- };
80
- }
81
- if (!Array.prototype.indexOf) {
82
- Array.prototype.indexOf = function (value /*, fromIndex */ ) {
83
- var length = this.length;
84
- var i = arguments[1] || 0;
85
-
86
- if (!length) return -1;
87
- if (i >= length) return -1;
88
- if (i < 0) i += length;
89
-
90
- for (; i < length; i++) {
91
- if (!Object.prototype.hasOwnProperty.call(this, i)) { continue }
92
- if (value === this[i]) return i;
93
- }
94
- return -1;
95
- };
96
- }
97
-
98
- //
99
- // Object
100
- //
101
- if (!Object.keys) {
102
- Object.keys = function (object) {
103
- var keys = [];
104
- for (var name in object) {
105
- if (Object.prototype.hasOwnProperty.call(object, name)) {
106
- keys.push(name);
107
- }
108
- }
109
- return keys;
110
- };
111
- }
112
-
113
- //
114
- // String
115
- //
116
- if (!String.prototype.trim) {
117
- String.prototype.trim = function () {
118
- return String(this).replace(/^\s\s*/, '').replace(/\s\s*$/, '');
119
- };
120
- }
@@ -1,7 +0,0 @@
1
- //
2
- // LESS - Leaner CSS v@VERSION
3
- // http://lesscss.org
4
- //
5
- // Copyright (c) 2009-2011, Alexis Sellier
6
- // Licensed under the Apache 2.0 License.
7
- //
@@ -1,355 +0,0 @@
1
- /**
2
- * cssmin.js
3
- * Author: Stoyan Stefanov - http://phpied.com/
4
- * This is a JavaScript port of the CSS minification tool
5
- * distributed with YUICompressor, itself a port
6
- * of the cssmin utility by Isaac Schlueter - http://foohack.com/
7
- * Permission is hereby granted to use the JavaScript version under the same
8
- * conditions as the YUICompressor (original YUICompressor note below).
9
- */
10
-
11
- /*
12
- * YUI Compressor
13
- * http://developer.yahoo.com/yui/compressor/
14
- * Author: Julien Lecomte - http://www.julienlecomte.net/
15
- * Copyright (c) 2011 Yahoo! Inc. All rights reserved.
16
- * The copyrights embodied in the content of this file are licensed
17
- * by Yahoo! Inc. under the BSD (revised) open source license.
18
- */
19
- var YAHOO = YAHOO || {};
20
- YAHOO.compressor = YAHOO.compressor || {};
21
-
22
- /**
23
- * Utility method to replace all data urls with tokens before we start
24
- * compressing, to avoid performance issues running some of the subsequent
25
- * regexes against large strings chunks.
26
- *
27
- * @private
28
- * @method _extractDataUrls
29
- * @param {String} css The input css
30
- * @param {Array} The global array of tokens to preserve
31
- * @returns String The processed css
32
- */
33
- YAHOO.compressor._extractDataUrls = function (css, preservedTokens) {
34
-
35
- // Leave data urls alone to increase parse performance.
36
- var maxIndex = css.length - 1,
37
- appendIndex = 0,
38
- startIndex,
39
- endIndex,
40
- terminator,
41
- foundTerminator,
42
- sb = [],
43
- m,
44
- preserver,
45
- token,
46
- pattern = /url\(\s*(["']?)data\:/g;
47
-
48
- // Since we need to account for non-base64 data urls, we need to handle
49
- // ' and ) being part of the data string. Hence switching to indexOf,
50
- // to determine whether or not we have matching string terminators and
51
- // handling sb appends directly, instead of using matcher.append* methods.
52
-
53
- while ((m = pattern.exec(css)) !== null) {
54
-
55
- startIndex = m.index + 4; // "url(".length()
56
- terminator = m[1]; // ', " or empty (not quoted)
57
-
58
- if (terminator.length === 0) {
59
- terminator = ")";
60
- }
61
-
62
- foundTerminator = false;
63
-
64
- endIndex = pattern.lastIndex - 1;
65
-
66
- while(foundTerminator === false && endIndex+1 <= maxIndex) {
67
- endIndex = css.indexOf(terminator, endIndex + 1);
68
-
69
- // endIndex == 0 doesn't really apply here
70
- if ((endIndex > 0) && (css.charAt(endIndex - 1) !== '\\')) {
71
- foundTerminator = true;
72
- if (")" != terminator) {
73
- endIndex = css.indexOf(")", endIndex);
74
- }
75
- }
76
- }
77
-
78
- // Enough searching, start moving stuff over to the buffer
79
- sb.push(css.substring(appendIndex, m.index));
80
-
81
- if (foundTerminator) {
82
- token = css.substring(startIndex, endIndex);
83
- token = token.replace(/\s+/g, "");
84
- preservedTokens.push(token);
85
-
86
- preserver = "url(___YUICSSMIN_PRESERVED_TOKEN_" + (preservedTokens.length - 1) + "___)";
87
- sb.push(preserver);
88
-
89
- appendIndex = endIndex + 1;
90
- } else {
91
- // No end terminator found, re-add the whole match. Should we throw/warn here?
92
- sb.push(css.substring(m.index, pattern.lastIndex));
93
- appendIndex = pattern.lastIndex;
94
- }
95
- }
96
-
97
- sb.push(css.substring(appendIndex));
98
-
99
- return sb.join("");
100
- };
101
-
102
- /**
103
- * Utility method to compress hex color values of the form #AABBCC to #ABC.
104
- *
105
- * DOES NOT compress CSS ID selectors which match the above pattern (which would break things).
106
- * e.g. #AddressForm { ... }
107
- *
108
- * DOES NOT compress IE filters, which have hex color values (which would break things).
109
- * e.g. filter: chroma(color="#FFFFFF");
110
- *
111
- * DOES NOT compress invalid hex values.
112
- * e.g. background-color: #aabbccdd
113
- *
114
- * @private
115
- * @method _compressHexColors
116
- * @param {String} css The input css
117
- * @returns String The processed css
118
- */
119
- YAHOO.compressor._compressHexColors = function(css) {
120
-
121
- // Look for hex colors inside { ... } (to avoid IDs) and which don't have a =, or a " in front of them (to avoid filters)
122
- var pattern = /(\=\s*?["']?)?#([0-9a-f])([0-9a-f])([0-9a-f])([0-9a-f])([0-9a-f])([0-9a-f])(\}|[^0-9a-f{][^{]*?\})/gi,
123
- m,
124
- index = 0,
125
- isFilter,
126
- sb = [];
127
-
128
- while ((m = pattern.exec(css)) !== null) {
129
-
130
- sb.push(css.substring(index, m.index));
131
-
132
- isFilter = m[1];
133
-
134
- if (isFilter) {
135
- // Restore, maintain case, otherwise filter will break
136
- sb.push(m[1] + "#" + (m[2] + m[3] + m[4] + m[5] + m[6] + m[7]));
137
- } else {
138
- if (m[2].toLowerCase() == m[3].toLowerCase() &&
139
- m[4].toLowerCase() == m[5].toLowerCase() &&
140
- m[6].toLowerCase() == m[7].toLowerCase()) {
141
-
142
- // Compress.
143
- sb.push("#" + (m[3] + m[5] + m[7]).toLowerCase());
144
- } else {
145
- // Non compressible color, restore but lower case.
146
- sb.push("#" + (m[2] + m[3] + m[4] + m[5] + m[6] + m[7]).toLowerCase());
147
- }
148
- }
149
-
150
- index = pattern.lastIndex = pattern.lastIndex - m[8].length;
151
- }
152
-
153
- sb.push(css.substring(index));
154
-
155
- return sb.join("");
156
- };
157
-
158
- YAHOO.compressor.cssmin = function (css, linebreakpos) {
159
-
160
- var startIndex = 0,
161
- endIndex = 0,
162
- i = 0, max = 0,
163
- preservedTokens = [],
164
- comments = [],
165
- token = '',
166
- totallen = css.length,
167
- placeholder = '';
168
-
169
- css = this._extractDataUrls(css, preservedTokens);
170
-
171
- // collect all comment blocks...
172
- while ((startIndex = css.indexOf("/*", startIndex)) >= 0) {
173
- endIndex = css.indexOf("*/", startIndex + 2);
174
- if (endIndex < 0) {
175
- endIndex = totallen;
176
- }
177
- token = css.slice(startIndex + 2, endIndex);
178
- comments.push(token);
179
- css = css.slice(0, startIndex + 2) + "___YUICSSMIN_PRESERVE_CANDIDATE_COMMENT_" + (comments.length - 1) + "___" + css.slice(endIndex);
180
- startIndex += 2;
181
- }
182
-
183
- // preserve strings so their content doesn't get accidentally minified
184
- css = css.replace(/("([^\\"]|\\.|\\)*")|('([^\\']|\\.|\\)*')/g, function (match) {
185
- var i, max, quote = match.substring(0, 1);
186
-
187
- match = match.slice(1, -1);
188
-
189
- // maybe the string contains a comment-like substring?
190
- // one, maybe more? put'em back then
191
- if (match.indexOf("___YUICSSMIN_PRESERVE_CANDIDATE_COMMENT_") >= 0) {
192
- for (i = 0, max = comments.length; i < max; i = i + 1) {
193
- match = match.replace("___YUICSSMIN_PRESERVE_CANDIDATE_COMMENT_" + i + "___", comments[i]);
194
- }
195
- }
196
-
197
- // minify alpha opacity in filter strings
198
- match = match.replace(/progid:DXImageTransform\.Microsoft\.Alpha\(Opacity=/gi, "alpha(opacity=");
199
-
200
- preservedTokens.push(match);
201
- return quote + "___YUICSSMIN_PRESERVED_TOKEN_" + (preservedTokens.length - 1) + "___" + quote;
202
- });
203
-
204
- // strings are safe, now wrestle the comments
205
- for (i = 0, max = comments.length; i < max; i = i + 1) {
206
-
207
- token = comments[i];
208
- placeholder = "___YUICSSMIN_PRESERVE_CANDIDATE_COMMENT_" + i + "___";
209
-
210
- // ! in the first position of the comment means preserve
211
- // so push to the preserved tokens keeping the !
212
- if (token.charAt(0) === "!") {
213
- preservedTokens.push(token);
214
- css = css.replace(placeholder, "___YUICSSMIN_PRESERVED_TOKEN_" + (preservedTokens.length - 1) + "___");
215
- continue;
216
- }
217
-
218
- // \ in the last position looks like hack for Mac/IE5
219
- // shorten that to /*\*/ and the next one to /**/
220
- if (token.charAt(token.length - 1) === "\\") {
221
- preservedTokens.push("\\");
222
- css = css.replace(placeholder, "___YUICSSMIN_PRESERVED_TOKEN_" + (preservedTokens.length - 1) + "___");
223
- i = i + 1; // attn: advancing the loop
224
- preservedTokens.push("");
225
- css = css.replace("___YUICSSMIN_PRESERVE_CANDIDATE_COMMENT_" + i + "___", "___YUICSSMIN_PRESERVED_TOKEN_" + (preservedTokens.length - 1) + "___");
226
- continue;
227
- }
228
-
229
- // keep empty comments after child selectors (IE7 hack)
230
- // e.g. html >/**/ body
231
- if (token.length === 0) {
232
- startIndex = css.indexOf(placeholder);
233
- if (startIndex > 2) {
234
- if (css.charAt(startIndex - 3) === '>') {
235
- preservedTokens.push("");
236
- css = css.replace(placeholder, "___YUICSSMIN_PRESERVED_TOKEN_" + (preservedTokens.length - 1) + "___");
237
- }
238
- }
239
- }
240
-
241
- // in all other cases kill the comment
242
- css = css.replace("/*" + placeholder + "*/", "");
243
- }
244
-
245
-
246
- // Normalize all whitespace strings to single spaces. Easier to work with that way.
247
- css = css.replace(/\s+/g, " ");
248
-
249
- // Remove the spaces before the things that should not have spaces before them.
250
- // But, be careful not to turn "p :link {...}" into "p:link{...}"
251
- // Swap out any pseudo-class colons with the token, and then swap back.
252
- css = css.replace(/(^|\})(([^\{:])+:)+([^\{]*\{)/g, function (m) {
253
- return m.replace(":", "___YUICSSMIN_PSEUDOCLASSCOLON___");
254
- });
255
- css = css.replace(/\s+([!{};:>+\(\)\],])/g, '$1');
256
- css = css.replace(/___YUICSSMIN_PSEUDOCLASSCOLON___/g, ":");
257
-
258
- // retain space for special IE6 cases
259
- css = css.replace(/:first-(line|letter)(\{|,)/g, ":first-$1 $2");
260
-
261
- // no space after the end of a preserved comment
262
- css = css.replace(/\*\/ /g, '*/');
263
-
264
-
265
- // If there is a @charset, then only allow one, and push to the top of the file.
266
- css = css.replace(/^(.*)(@charset "[^"]*";)/gi, '$2$1');
267
- css = css.replace(/^(\s*@charset [^;]+;\s*)+/gi, '$1');
268
-
269
- // Put the space back in some cases, to support stuff like
270
- // @media screen and (-webkit-min-device-pixel-ratio:0){
271
- css = css.replace(/\band\(/gi, "and (");
272
-
273
-
274
- // Remove the spaces after the things that should not have spaces after them.
275
- css = css.replace(/([!{}:;>+\(\[,])\s+/g, '$1');
276
-
277
- // remove unnecessary semicolons
278
- css = css.replace(/;+\}/g, "}");
279
-
280
- // Replace 0(px,em,%) with 0.
281
- css = css.replace(/([\s:])(0)(px|em|%|in|cm|mm|pc|pt|ex)/gi, "$1$2");
282
-
283
- // Replace 0 0 0 0; with 0.
284
- css = css.replace(/:0 0 0 0(;|\})/g, ":0$1");
285
- css = css.replace(/:0 0 0(;|\})/g, ":0$1");
286
- css = css.replace(/:0 0(;|\})/g, ":0$1");
287
-
288
- // Replace background-position:0; with background-position:0 0;
289
- // same for transform-origin
290
- css = css.replace(/(background-position|transform-origin|webkit-transform-origin|moz-transform-origin|o-transform-origin|ms-transform-origin):0(;|\})/gi, function(all, prop, tail) {
291
- return prop.toLowerCase() + ":0 0" + tail;
292
- });
293
-
294
- // Replace 0.6 to .6, but only when preceded by : or a white-space
295
- css = css.replace(/(:|\s)0+\.(\d+)/g, "$1.$2");
296
-
297
- // Shorten colors from rgb(51,102,153) to #336699
298
- // This makes it more likely that it'll get further compressed in the next step.
299
- css = css.replace(/rgb\s*\(\s*([0-9,\s]+)\s*\)/gi, function () {
300
- var i, rgbcolors = arguments[1].split(',');
301
- for (i = 0; i < rgbcolors.length; i = i + 1) {
302
- rgbcolors[i] = parseInt(rgbcolors[i], 10).toString(16);
303
- if (rgbcolors[i].length === 1) {
304
- rgbcolors[i] = '0' + rgbcolors[i];
305
- }
306
- }
307
- return '#' + rgbcolors.join('');
308
- });
309
-
310
- // Shorten colors from #AABBCC to #ABC.
311
- css = this._compressHexColors(css);
312
-
313
- // border: none -> border:0
314
- css = css.replace(/(border|border-top|border-right|border-bottom|border-right|outline|background):none(;|\})/gi, function(all, prop, tail) {
315
- return prop.toLowerCase() + ":0" + tail;
316
- });
317
-
318
- // shorter opacity IE filter
319
- css = css.replace(/progid:DXImageTransform\.Microsoft\.Alpha\(Opacity=/gi, "alpha(opacity=");
320
-
321
- // Remove empty rules.
322
- css = css.replace(/[^\};\{\/]+\{\}/g, "");
323
-
324
- if (linebreakpos >= 0) {
325
- // Some source control tools don't like it when files containing lines longer
326
- // than, say 8000 characters, are checked in. The linebreak option is used in
327
- // that case to split long lines after a specific column.
328
- startIndex = 0;
329
- i = 0;
330
- while (i < css.length) {
331
- i = i + 1;
332
- if (css[i - 1] === '}' && i - startIndex > linebreakpos) {
333
- css = css.slice(0, i) + '\n' + css.slice(i);
334
- startIndex = i;
335
- }
336
- }
337
- }
338
-
339
- // Replace multiple semi-colons in a row by a single one
340
- // See SF bug #1980989
341
- css = css.replace(/;;+/g, ";");
342
-
343
- // restore preserved comments and strings
344
- for (i = 0, max = preservedTokens.length; i < max; i = i + 1) {
345
- css = css.replace("___YUICSSMIN_PRESERVED_TOKEN_" + i + "___", preservedTokens[i]);
346
- }
347
-
348
- // Trim the final string (for any leading or trailing white spaces)
349
- css = css.replace(/^\s+|\s+$/g, "");
350
-
351
- return css;
352
-
353
- };
354
-
355
- exports.compressor = YAHOO.compressor;