stylus-source 0.15.4 → 0.17.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (577) hide show
  1. data/.gitignore +1 -0
  2. data/Rakefile +39 -0
  3. data/VERSION +1 -0
  4. data/lib/stylus/source.rb +1 -1
  5. data/stylus-source.gemspec +2 -2
  6. data/vendor/History.md +525 -0
  7. data/vendor/LICENSE +22 -0
  8. data/vendor/Makefile +20 -0
  9. data/vendor/Readme.md +127 -0
  10. data/vendor/bin/stylus +606 -0
  11. data/vendor/bm.js +22 -0
  12. data/vendor/docs/bifs.md +582 -0
  13. data/vendor/docs/comments.md +35 -0
  14. data/vendor/docs/compare.md +81 -0
  15. data/vendor/docs/conditionals.md +107 -0
  16. data/vendor/docs/css-style.md +77 -0
  17. data/vendor/docs/error-reporting.md +50 -0
  18. data/vendor/docs/escape.md +27 -0
  19. data/vendor/docs/executable.md +159 -0
  20. data/vendor/docs/firebug.md +60 -0
  21. data/vendor/docs/font-face.md +26 -0
  22. data/vendor/docs/functions.md +192 -0
  23. data/vendor/docs/functions.url.md +30 -0
  24. data/vendor/docs/gedit.md +24 -0
  25. data/vendor/docs/import.md +73 -0
  26. data/vendor/docs/interpolation.md +55 -0
  27. data/vendor/docs/introspection.md +39 -0
  28. data/vendor/docs/iteration.md +100 -0
  29. data/vendor/docs/js.md +136 -0
  30. data/vendor/docs/keyframes.md +120 -0
  31. data/vendor/docs/kwargs.md +35 -0
  32. data/vendor/docs/literal.md +16 -0
  33. data/vendor/docs/media.md +18 -0
  34. data/vendor/docs/middleware.md +73 -0
  35. data/vendor/docs/mixins.md +130 -0
  36. data/vendor/docs/operators.md +451 -0
  37. data/vendor/docs/selectors.md +131 -0
  38. data/vendor/docs/textmate.md +4 -0
  39. data/vendor/docs/vargs.md +84 -0
  40. data/vendor/docs/variables.md +78 -0
  41. data/vendor/editors/Stylus.tmbundle/Commands/Compile and Display CSS.tmCommand +33 -0
  42. data/vendor/editors/Stylus.tmbundle/Preferences/Comments.tmPreferences +36 -0
  43. data/vendor/editors/Stylus.tmbundle/Syntaxes/Stylus.tmLanguage +166 -0
  44. data/vendor/editors/Stylus.tmbundle/info.plist +10 -0
  45. data/vendor/editors/gedit/styl.lang +475 -0
  46. data/vendor/examples/arithmetic.js +12 -0
  47. data/vendor/examples/arithmetic.styl +29 -0
  48. data/vendor/examples/basic.js +12 -0
  49. data/vendor/examples/basic.styl +8 -0
  50. data/vendor/examples/builtins.js +12 -0
  51. data/vendor/examples/builtins.styl +56 -0
  52. data/vendor/examples/comments.js +11 -0
  53. data/vendor/examples/comments.styl +15 -0
  54. data/vendor/examples/compress.js +12 -0
  55. data/vendor/examples/conversions.js +12 -0
  56. data/vendor/examples/conversions.styl +34 -0
  57. data/vendor/examples/functions.js +12 -0
  58. data/vendor/examples/functions.styl +30 -0
  59. data/vendor/examples/gradients.js +13 -0
  60. data/vendor/examples/gradients.styl +8 -0
  61. data/vendor/examples/images/gopher.jpg +0 -0
  62. data/vendor/examples/images/gradient.svg +9 -0
  63. data/vendor/examples/images/jesus.gif +0 -0
  64. data/vendor/examples/images/sprite.gif +0 -0
  65. data/vendor/examples/images.js +20 -0
  66. data/vendor/examples/images.styl +15 -0
  67. data/vendor/examples/implicit-functions.js +12 -0
  68. data/vendor/examples/implicit-functions.styl +23 -0
  69. data/vendor/examples/import.js +12 -0
  70. data/vendor/examples/import.styl +11 -0
  71. data/vendor/examples/js-functions.js +55 -0
  72. data/vendor/examples/js-functions.styl +23 -0
  73. data/vendor/examples/literal.js +12 -0
  74. data/vendor/examples/literal.styl +8 -0
  75. data/vendor/examples/middleware.js +23 -0
  76. data/vendor/examples/mixins/box.styl +14 -0
  77. data/vendor/examples/mixins/gradients.styl +92 -0
  78. data/vendor/examples/nesting.js +12 -0
  79. data/vendor/examples/nesting.styl +14 -0
  80. data/vendor/examples/variables.js +12 -0
  81. data/vendor/examples/variables.styl +24 -0
  82. data/vendor/index.js +2 -0
  83. data/{lib/stylus → vendor/lib}/colors.js +0 -0
  84. data/{lib/stylus → vendor/lib}/convert/css.js +0 -0
  85. data/{lib/stylus → vendor/lib}/errors.js +0 -0
  86. data/{lib/stylus → vendor/lib}/functions/image.js +0 -0
  87. data/{lib/stylus → vendor/lib}/functions/index.js +0 -0
  88. data/{lib/stylus → vendor/lib}/functions/index.styl +11 -2
  89. data/{lib/stylus → vendor/lib}/functions/url.js +0 -0
  90. data/{lib/stylus → vendor/lib}/lexer.js +14 -1
  91. data/{lib/stylus → vendor/lib}/middleware.js +5 -1
  92. data/{lib/stylus → vendor/lib}/nodes/arguments.js +0 -0
  93. data/{lib/stylus → vendor/lib}/nodes/binop.js +0 -0
  94. data/{lib/stylus → vendor/lib}/nodes/block.js +0 -0
  95. data/{lib/stylus → vendor/lib}/nodes/boolean.js +0 -0
  96. data/{lib/stylus → vendor/lib}/nodes/call.js +0 -0
  97. data/{lib/stylus → vendor/lib}/nodes/charset.js +0 -0
  98. data/{lib/stylus → vendor/lib}/nodes/comment.js +0 -0
  99. data/{lib/stylus → vendor/lib}/nodes/each.js +0 -0
  100. data/{lib/stylus → vendor/lib}/nodes/expression.js +32 -0
  101. data/{lib/stylus → vendor/lib}/nodes/fontface.js +0 -0
  102. data/{lib/stylus → vendor/lib}/nodes/function.js +0 -0
  103. data/{lib/stylus → vendor/lib}/nodes/group.js +0 -0
  104. data/{lib/stylus → vendor/lib}/nodes/hsla.js +0 -0
  105. data/{lib/stylus → vendor/lib}/nodes/ident.js +0 -0
  106. data/{lib/stylus → vendor/lib}/nodes/if.js +0 -0
  107. data/{lib/stylus → vendor/lib}/nodes/import.js +0 -0
  108. data/{lib/stylus → vendor/lib}/nodes/index.js +0 -0
  109. data/{lib/stylus → vendor/lib}/nodes/jsliteral.js +0 -0
  110. data/{lib/stylus → vendor/lib}/nodes/keyframes.js +0 -0
  111. data/{lib/stylus → vendor/lib}/nodes/literal.js +0 -0
  112. data/{lib/stylus → vendor/lib}/nodes/media.js +0 -0
  113. data/{lib/stylus → vendor/lib}/nodes/node.js +14 -0
  114. data/{lib/stylus → vendor/lib}/nodes/null.js +0 -0
  115. data/{lib/stylus → vendor/lib}/nodes/page.js +0 -0
  116. data/{lib/stylus → vendor/lib}/nodes/params.js +0 -0
  117. data/{lib/stylus → vendor/lib}/nodes/property.js +0 -0
  118. data/{lib/stylus → vendor/lib}/nodes/return.js +0 -0
  119. data/{lib/stylus → vendor/lib}/nodes/rgba.js +4 -2
  120. data/{lib/stylus → vendor/lib}/nodes/root.js +0 -0
  121. data/{lib/stylus → vendor/lib}/nodes/selector.js +0 -0
  122. data/{lib/stylus → vendor/lib}/nodes/string.js +0 -0
  123. data/{lib/stylus → vendor/lib}/nodes/ternary.js +0 -0
  124. data/{lib/stylus → vendor/lib}/nodes/unaryop.js +0 -0
  125. data/{lib/stylus → vendor/lib}/nodes/unit.js +0 -0
  126. data/{lib/stylus → vendor/lib}/parser.js +17 -2
  127. data/{lib/stylus → vendor/lib}/renderer.js +0 -0
  128. data/{lib/stylus → vendor/lib}/stack/frame.js +0 -0
  129. data/{lib/stylus → vendor/lib}/stack/index.js +0 -0
  130. data/{lib/stylus → vendor/lib}/stack/scope.js +0 -0
  131. data/{lib/stylus → vendor/lib}/stylus.js +1 -1
  132. data/{lib/stylus → vendor/lib}/token.js +0 -0
  133. data/{lib/stylus → vendor/lib}/utils.js +0 -0
  134. data/{lib/stylus → vendor/lib}/visitor/compiler.js +1 -0
  135. data/{lib/stylus → vendor/lib}/visitor/evaluator.js +9 -3
  136. data/{lib/stylus → vendor/lib}/visitor/index.js +0 -0
  137. data/{lib → vendor}/node_modules/cssom/Jakefile +0 -0
  138. data/{lib → vendor}/node_modules/cssom/README.mdown +0 -0
  139. data/{lib → vendor}/node_modules/cssom/Rakefile +0 -0
  140. data/{lib → vendor}/node_modules/cssom/docs/bar.css +0 -0
  141. data/{lib → vendor}/node_modules/cssom/docs/demo.css +0 -0
  142. data/{lib → vendor}/node_modules/cssom/docs/foo.css +0 -0
  143. data/{lib → vendor}/node_modules/cssom/docs/parse.html +0 -0
  144. data/{lib → vendor}/node_modules/cssom/docs/parse2.html +0 -0
  145. data/{lib → vendor}/node_modules/cssom/index.html +0 -0
  146. data/{lib → vendor}/node_modules/cssom/lib/CSSImportRule.js +0 -0
  147. data/{lib → vendor}/node_modules/cssom/lib/CSSMediaRule.js +0 -0
  148. data/{lib → vendor}/node_modules/cssom/lib/CSSOM.js +0 -0
  149. data/{lib → vendor}/node_modules/cssom/lib/CSSRule.js +0 -0
  150. data/{lib → vendor}/node_modules/cssom/lib/CSSStyleDeclaration.js +0 -0
  151. data/{lib → vendor}/node_modules/cssom/lib/CSSStyleRule.js +0 -0
  152. data/{lib → vendor}/node_modules/cssom/lib/CSSStyleSheet.js +0 -0
  153. data/{lib → vendor}/node_modules/cssom/lib/MediaList.js +0 -0
  154. data/{lib → vendor}/node_modules/cssom/lib/StyleSheet.js +0 -0
  155. data/{lib → vendor}/node_modules/cssom/lib/clone.js +0 -0
  156. data/{lib → vendor}/node_modules/cssom/lib/index.js +0 -0
  157. data/{lib → vendor}/node_modules/cssom/lib/parse.js +0 -0
  158. data/{lib → vendor}/node_modules/cssom/media.html +0 -0
  159. data/{lib → vendor}/node_modules/cssom/package.json +0 -0
  160. data/{lib → vendor}/node_modules/cssom/plugins/toHTML.js +0 -0
  161. data/{lib → vendor}/node_modules/cssom/server/index.html +0 -0
  162. data/{lib → vendor}/node_modules/cssom/server/index.js +0 -0
  163. data/{lib → vendor}/node_modules/cssom/shorthands.html +0 -0
  164. data/{lib → vendor}/node_modules/cssom/test/CSSStyleDeclaration.test.js +0 -0
  165. data/{lib → vendor}/node_modules/cssom/test/CSSStyleRule.test.js +0 -0
  166. data/{lib → vendor}/node_modules/cssom/test/CSSStyleSheet.test.js +0 -0
  167. data/{lib → vendor}/node_modules/cssom/test/MediaList.test.js +0 -0
  168. data/{lib → vendor}/node_modules/cssom/test/clone.test.js +0 -0
  169. data/{lib → vendor}/node_modules/cssom/test/fixtures/dummy.css +0 -0
  170. data/{lib → vendor}/node_modules/cssom/test/helper.js +0 -0
  171. data/{lib → vendor}/node_modules/cssom/test/index.html +0 -0
  172. data/{lib → vendor}/node_modules/cssom/test/parse.test.js +0 -0
  173. data/{lib → vendor}/node_modules/cssom/test/vendor/qunit.css +0 -0
  174. data/{lib → vendor}/node_modules/cssom/test/vendor/qunit.js +0 -0
  175. data/{lib → vendor}/node_modules/growl/History.md +0 -0
  176. data/{lib → vendor}/node_modules/growl/Readme.md +0 -0
  177. data/{lib → vendor}/node_modules/growl/lib/growl.js +0 -0
  178. data/{lib → vendor}/node_modules/growl/package.json +0 -0
  179. data/{lib → vendor}/node_modules/growl/test.js +0 -0
  180. data/vendor/node_modules/mkdirp/LICENSE +21 -0
  181. data/vendor/node_modules/mkdirp/README.markdown +21 -0
  182. data/vendor/node_modules/mkdirp/examples/pow.js +6 -0
  183. data/vendor/node_modules/mkdirp/examples/pow.js.orig +6 -0
  184. data/vendor/node_modules/mkdirp/examples/pow.js.rej +19 -0
  185. data/vendor/node_modules/mkdirp/index.js +20 -0
  186. data/vendor/node_modules/mkdirp/package.json +23 -0
  187. data/vendor/node_modules/mkdirp/test/mkdirp.js +28 -0
  188. data/vendor/node_modules/mkdirp/test/race.js +41 -0
  189. data/vendor/node_modules/mkdirp/test/rel.js +32 -0
  190. data/vendor/package.json +16 -0
  191. data/vendor/test/cases/arithmetic.color.css +44 -0
  192. data/vendor/test/cases/arithmetic.color.styl +48 -0
  193. data/vendor/test/cases/arithmetic.css +23 -0
  194. data/vendor/test/cases/arithmetic.styl +30 -0
  195. data/vendor/test/cases/arithmetic.unary.css +16 -0
  196. data/vendor/test/cases/arithmetic.unary.styl +16 -0
  197. data/vendor/test/cases/atscope.css +21 -0
  198. data/vendor/test/cases/atscope.styl +23 -0
  199. data/vendor/test/cases/bifs.add-property.css +21 -0
  200. data/vendor/test/cases/bifs.add-property.styl +48 -0
  201. data/vendor/test/cases/bifs.components.css +9 -0
  202. data/vendor/test/cases/bifs.components.styl +9 -0
  203. data/vendor/test/cases/bifs.dark.css +5 -0
  204. data/vendor/test/cases/bifs.dark.styl +4 -0
  205. data/vendor/test/cases/bifs.darken.css +8 -0
  206. data/vendor/test/cases/bifs.darken.styl +9 -0
  207. data/vendor/test/cases/bifs.fade.css +6 -0
  208. data/vendor/test/cases/bifs.fade.styl +6 -0
  209. data/vendor/test/cases/bifs.image-size.css +9 -0
  210. data/vendor/test/cases/bifs.image-size.styl +16 -0
  211. data/vendor/test/cases/bifs.join.css +18 -0
  212. data/vendor/test/cases/bifs.join.styl +21 -0
  213. data/vendor/test/cases/bifs.last.css +5 -0
  214. data/vendor/test/cases/bifs.last.styl +6 -0
  215. data/vendor/test/cases/bifs.length.css +10 -0
  216. data/vendor/test/cases/bifs.length.styl +18 -0
  217. data/vendor/test/cases/bifs.light.css +5 -0
  218. data/vendor/test/cases/bifs.light.styl +4 -0
  219. data/vendor/test/cases/bifs.lighten.css +14 -0
  220. data/vendor/test/cases/bifs.lighten.styl +14 -0
  221. data/vendor/test/cases/bifs.lookup.css +3 -0
  222. data/vendor/test/cases/bifs.lookup.styl +8 -0
  223. data/vendor/test/cases/bifs.match.css +4 -0
  224. data/vendor/test/cases/bifs.match.styl +9 -0
  225. data/vendor/test/cases/bifs.opposite-position.css +8 -0
  226. data/vendor/test/cases/bifs.opposite-position.styl +9 -0
  227. data/vendor/test/cases/bifs.push.css +25 -0
  228. data/vendor/test/cases/bifs.push.styl +48 -0
  229. data/vendor/test/cases/bifs.rgba.css +5 -0
  230. data/vendor/test/cases/bifs.rgba.styl +4 -0
  231. data/vendor/test/cases/bifs.s.css +11 -0
  232. data/vendor/test/cases/bifs.s.styl +12 -0
  233. data/vendor/test/cases/bifs.type.css +11 -0
  234. data/vendor/test/cases/bifs.type.styl +12 -0
  235. data/vendor/test/cases/bifs.unit.css +6 -0
  236. data/vendor/test/cases/bifs.unit.styl +5 -0
  237. data/vendor/test/cases/bifs.unquote.css +5 -0
  238. data/vendor/test/cases/bifs.unquote.styl +8 -0
  239. data/vendor/test/cases/bifs.url.css +11 -0
  240. data/vendor/test/cases/bifs.url.styl +15 -0
  241. data/vendor/test/cases/coercion.css +6 -0
  242. data/vendor/test/cases/coercion.styl +5 -0
  243. data/vendor/test/cases/comments.css +18 -0
  244. data/vendor/test/cases/comments.styl +28 -0
  245. data/vendor/test/cases/compress.comments.css +2 -0
  246. data/vendor/test/cases/compress.comments.styl +5 -0
  247. data/vendor/test/cases/compress.units.css +2 -0
  248. data/vendor/test/cases/compress.units.styl +18 -0
  249. data/vendor/test/cases/conditional-assignment.css +4 -0
  250. data/vendor/test/cases/conditional-assignment.styl +9 -0
  251. data/vendor/test/cases/control.blueprint.ie.css +126 -0
  252. data/vendor/test/cases/control.blueprint.ie.styl +36 -0
  253. data/vendor/test/cases/control.blueprint.screen.css +1103 -0
  254. data/vendor/test/cases/control.blueprint.screen.styl +265 -0
  255. data/vendor/test/cases/control.boilerplate.css +473 -0
  256. data/vendor/test/cases/control.boilerplate.styl +265 -0
  257. data/vendor/test/cases/css.functions.single-line.css +9 -0
  258. data/vendor/test/cases/css.functions.single-line.styl +13 -0
  259. data/vendor/test/cases/css.if.css +8 -0
  260. data/vendor/test/cases/css.if.styl +21 -0
  261. data/vendor/test/cases/css.keyframes.css +57 -0
  262. data/vendor/test/cases/css.keyframes.styl +48 -0
  263. data/vendor/test/cases/css.large.css +172 -0
  264. data/vendor/test/cases/css.large.styl +172 -0
  265. data/vendor/test/cases/css.media.css +15 -0
  266. data/vendor/test/cases/css.media.styl +17 -0
  267. data/vendor/test/cases/css.mixins.braces.css +38 -0
  268. data/vendor/test/cases/css.mixins.braces.styl +53 -0
  269. data/vendor/test/cases/css.mixins.css +38 -0
  270. data/vendor/test/cases/css.mixins.root.css +26 -0
  271. data/vendor/test/cases/css.mixins.root.styl +25 -0
  272. data/vendor/test/cases/css.mixins.root.wonky.css +26 -0
  273. data/vendor/test/cases/css.mixins.root.wonky.styl +17 -0
  274. data/vendor/test/cases/css.mixins.styl +47 -0
  275. data/vendor/test/cases/css.selector.interpolation.css +91 -0
  276. data/vendor/test/cases/css.selector.interpolation.styl +90 -0
  277. data/vendor/test/cases/css.selectors.css +38 -0
  278. data/vendor/test/cases/css.selectors.styl +53 -0
  279. data/vendor/test/cases/css.whitespace.css +37 -0
  280. data/vendor/test/cases/css.whitespace.styl +38 -0
  281. data/vendor/test/cases/escape.css +4 -0
  282. data/vendor/test/cases/escape.styl +4 -0
  283. data/vendor/test/cases/fontface.css +4 -0
  284. data/vendor/test/cases/fontface.styl +5 -0
  285. data/vendor/test/cases/for.complex.css +44 -0
  286. data/vendor/test/cases/for.complex.styl +28 -0
  287. data/vendor/test/cases/for.css +52 -0
  288. data/vendor/test/cases/for.function.css +20 -0
  289. data/vendor/test/cases/for.function.styl +51 -0
  290. data/vendor/test/cases/for.styl +44 -0
  291. data/vendor/test/cases/function.arguments.css +4 -0
  292. data/vendor/test/cases/function.arguments.styl +14 -0
  293. data/vendor/test/cases/function.literals.css +6 -0
  294. data/vendor/test/cases/function.literals.styl +12 -0
  295. data/vendor/test/cases/functions.arg-calls.css +3 -0
  296. data/vendor/test/cases/functions.arg-calls.styl +9 -0
  297. data/vendor/test/cases/functions.call.css +4 -0
  298. data/vendor/test/cases/functions.call.styl +7 -0
  299. data/vendor/test/cases/functions.css +11 -0
  300. data/vendor/test/cases/functions.defaults.css +15 -0
  301. data/vendor/test/cases/functions.defaults.styl +30 -0
  302. data/vendor/test/cases/functions.multi-line.css +9 -0
  303. data/vendor/test/cases/functions.multi-line.styl +25 -0
  304. data/vendor/test/cases/functions.multiple-calls.css +13 -0
  305. data/vendor/test/cases/functions.multiple-calls.styl +26 -0
  306. data/vendor/test/cases/functions.nested-calls.css +3 -0
  307. data/vendor/test/cases/functions.nested-calls.styl +9 -0
  308. data/vendor/test/cases/functions.nested.css +10 -0
  309. data/vendor/test/cases/functions.nested.styl +37 -0
  310. data/vendor/test/cases/functions.property.css +10 -0
  311. data/vendor/test/cases/functions.property.styl +11 -0
  312. data/vendor/test/cases/functions.return.css +15 -0
  313. data/vendor/test/cases/functions.return.each.css +10 -0
  314. data/vendor/test/cases/functions.return.each.styl +23 -0
  315. data/vendor/test/cases/functions.return.styl +86 -0
  316. data/vendor/test/cases/functions.styl +34 -0
  317. data/vendor/test/cases/functions.variable.css +9 -0
  318. data/vendor/test/cases/functions.variable.ident.css +3 -0
  319. data/vendor/test/cases/functions.variable.ident.styl +11 -0
  320. data/vendor/test/cases/functions.variable.styl +27 -0
  321. data/vendor/test/cases/hack.star.css +27 -0
  322. data/vendor/test/cases/hack.star.styl +37 -0
  323. data/vendor/test/cases/if.css +43 -0
  324. data/vendor/test/cases/if.else.css +6 -0
  325. data/vendor/test/cases/if.else.styl +16 -0
  326. data/vendor/test/cases/if.mixin.css +7 -0
  327. data/vendor/test/cases/if.mixin.styl +24 -0
  328. data/vendor/test/cases/if.postfix.css +61 -0
  329. data/vendor/test/cases/if.postfix.styl +110 -0
  330. data/vendor/test/cases/if.selectors.css +16 -0
  331. data/vendor/test/cases/if.selectors.styl +22 -0
  332. data/vendor/test/cases/if.styl +99 -0
  333. data/vendor/test/cases/import.basic/a.styl +5 -0
  334. data/vendor/test/cases/import.basic/b.styl +5 -0
  335. data/vendor/test/cases/import.basic/c.styl +3 -0
  336. data/vendor/test/cases/import.basic.css +11 -0
  337. data/vendor/test/cases/import.basic.styl +4 -0
  338. data/vendor/test/cases/import.complex/a.styl +4 -0
  339. data/vendor/test/cases/import.complex/c.styl +2 -0
  340. data/vendor/test/cases/import.complex/nested/b.styl +4 -0
  341. data/vendor/test/cases/import.complex.css +9 -0
  342. data/vendor/test/cases/import.complex.styl +1 -0
  343. data/vendor/test/cases/import.index/vendor/a.styl +2 -0
  344. data/vendor/test/cases/import.index/vendor/b.styl +2 -0
  345. data/vendor/test/cases/import.index/vendor/c.styl +2 -0
  346. data/vendor/test/cases/import.index/vendor/index.styl +4 -0
  347. data/vendor/test/cases/import.index.css +9 -0
  348. data/vendor/test/cases/import.index.styl +2 -0
  349. data/vendor/test/cases/import.literal.css +2 -0
  350. data/vendor/test/cases/import.literal.styl +3 -0
  351. data/vendor/test/cases/import.mixins.css +7 -0
  352. data/vendor/test/cases/import.mixins.styl +9 -0
  353. data/vendor/test/cases/import.ordering/five.styl +2 -0
  354. data/vendor/test/cases/import.ordering/four.styl +4 -0
  355. data/vendor/test/cases/import.ordering/two.styl +2 -0
  356. data/vendor/test/cases/import.ordering.css +15 -0
  357. data/vendor/test/cases/import.ordering.styl +12 -0
  358. data/vendor/test/cases/important.css +6 -0
  359. data/vendor/test/cases/important.styl +6 -0
  360. data/vendor/test/cases/interpolation.properties.css +40 -0
  361. data/vendor/test/cases/interpolation.properties.styl +56 -0
  362. data/vendor/test/cases/introspection.css +7 -0
  363. data/vendor/test/cases/introspection.styl +14 -0
  364. data/vendor/test/cases/jquery.css +3 -0
  365. data/vendor/test/cases/jquery.styl +5 -0
  366. data/vendor/test/cases/keyframes.css +9 -0
  367. data/vendor/test/cases/keyframes.fabrication.css +18 -0
  368. data/vendor/test/cases/keyframes.fabrication.defaults.css +45 -0
  369. data/vendor/test/cases/keyframes.fabrication.defaults.styl +9 -0
  370. data/vendor/test/cases/keyframes.fabrication.styl +11 -0
  371. data/vendor/test/cases/keyframes.styl +6 -0
  372. data/vendor/test/cases/kwargs.css +63 -0
  373. data/vendor/test/cases/kwargs.styl +74 -0
  374. data/vendor/test/cases/list.css +3 -0
  375. data/vendor/test/cases/list.styl +3 -0
  376. data/vendor/test/cases/literal.color.css +6 -0
  377. data/vendor/test/cases/literal.color.styl +5 -0
  378. data/vendor/test/cases/literal.css +10 -0
  379. data/vendor/test/cases/literal.styl +18 -0
  380. data/vendor/test/cases/media.css +14 -0
  381. data/vendor/test/cases/media.styl +11 -0
  382. data/vendor/test/cases/mixin.conditional.css +19 -0
  383. data/vendor/test/cases/mixin.conditional.styl +36 -0
  384. data/vendor/test/cases/mixin.order.conditional.css +11 -0
  385. data/vendor/test/cases/mixin.order.conditional.styl +20 -0
  386. data/vendor/test/cases/mixin.order.css +9 -0
  387. data/vendor/test/cases/mixin.order.nested.css +9 -0
  388. data/vendor/test/cases/mixin.order.nested.styl +21 -0
  389. data/vendor/test/cases/mixin.order.styl +20 -0
  390. data/vendor/test/cases/mixins/box.styl +11 -0
  391. data/vendor/test/cases/mixins.complex.css +30 -0
  392. data/vendor/test/cases/mixins.complex.fix-to.css +15 -0
  393. data/vendor/test/cases/mixins.complex.fix-to.styl +28 -0
  394. data/vendor/test/cases/mixins.complex.styl +41 -0
  395. data/vendor/test/cases/mixins.conditional.css +3 -0
  396. data/vendor/test/cases/mixins.conditional.styl +8 -0
  397. data/vendor/test/cases/mixins.nested.css +7 -0
  398. data/vendor/test/cases/mixins.nested.selectors.css +21 -0
  399. data/vendor/test/cases/mixins.nested.selectors.styl +31 -0
  400. data/vendor/test/cases/mixins.nested.styl +14 -0
  401. data/vendor/test/cases/mixins.order.2.css +11 -0
  402. data/vendor/test/cases/mixins.order.2.styl +16 -0
  403. data/vendor/test/cases/mixins.reset.css +75 -0
  404. data/vendor/test/cases/mixins.reset.styl +27 -0
  405. data/vendor/test/cases/mixins.return.css +4 -0
  406. data/vendor/test/cases/mixins.return.styl +8 -0
  407. data/vendor/test/cases/mixins.root.css +3 -0
  408. data/vendor/test/cases/mixins.root.styl +5 -0
  409. data/vendor/test/cases/operator.range.css +15 -0
  410. data/vendor/test/cases/operator.range.styl +23 -0
  411. data/vendor/test/cases/operators.assignment.function.css +15 -0
  412. data/vendor/test/cases/operators.assignment.function.styl +34 -0
  413. data/vendor/test/cases/operators.assignment.mixin.css +15 -0
  414. data/vendor/test/cases/operators.assignment.mixin.styl +39 -0
  415. data/vendor/test/cases/operators.assignment.root.css +25 -0
  416. data/vendor/test/cases/operators.assignment.root.styl +55 -0
  417. data/vendor/test/cases/operators.complex.css +9 -0
  418. data/vendor/test/cases/operators.complex.styl +32 -0
  419. data/vendor/test/cases/operators.css +40 -0
  420. data/vendor/test/cases/operators.equality.css +55 -0
  421. data/vendor/test/cases/operators.equality.styl +55 -0
  422. data/vendor/test/cases/operators.in.css +37 -0
  423. data/vendor/test/cases/operators.in.styl +51 -0
  424. data/vendor/test/cases/operators.mixins.css +10 -0
  425. data/vendor/test/cases/operators.mixins.styl +25 -0
  426. data/vendor/test/cases/operators.precedence.css +51 -0
  427. data/vendor/test/cases/operators.precedence.styl +82 -0
  428. data/vendor/test/cases/operators.styl +96 -0
  429. data/vendor/test/cases/operators.subscript.assign.css +21 -0
  430. data/vendor/test/cases/operators.subscript.assign.styl +45 -0
  431. data/vendor/test/cases/operators.subscript.css +59 -0
  432. data/vendor/test/cases/operators.subscript.range.css +14 -0
  433. data/vendor/test/cases/operators.subscript.range.styl +15 -0
  434. data/vendor/test/cases/operators.subscript.styl +81 -0
  435. data/vendor/test/cases/page.css +13 -0
  436. data/vendor/test/cases/page.styl +13 -0
  437. data/vendor/test/cases/parent.css +32 -0
  438. data/vendor/test/cases/parent.styl +33 -0
  439. data/vendor/test/cases/properties.colons.css +8 -0
  440. data/vendor/test/cases/properties.colons.styl +10 -0
  441. data/vendor/test/cases/properties.css +4 -0
  442. data/vendor/test/cases/properties.one-line.css +10 -0
  443. data/vendor/test/cases/properties.one-line.styl +11 -0
  444. data/vendor/test/cases/properties.styl +4 -0
  445. data/vendor/test/cases/property-access.css +48 -0
  446. data/vendor/test/cases/property-access.styl +62 -0
  447. data/vendor/test/cases/regression.107.lookup-failure.css +12 -0
  448. data/vendor/test/cases/regression.107.lookup-failure.styl +13 -0
  449. data/vendor/test/cases/regression.127.css +3 -0
  450. data/vendor/test/cases/regression.127.styl +2 -0
  451. data/vendor/test/cases/regression.130.css +16 -0
  452. data/vendor/test/cases/regression.130.styl +6 -0
  453. data/vendor/test/cases/regression.131.css +7 -0
  454. data/vendor/test/cases/regression.131.styl +2 -0
  455. data/vendor/test/cases/regression.137.css +7 -0
  456. data/vendor/test/cases/regression.137.styl +7 -0
  457. data/vendor/test/cases/regression.139.css +5 -0
  458. data/vendor/test/cases/regression.139.styl +21 -0
  459. data/vendor/test/cases/regression.142.css +39 -0
  460. data/vendor/test/cases/regression.142.styl +54 -0
  461. data/vendor/test/cases/regression.146.css +30 -0
  462. data/vendor/test/cases/regression.146.styl +31 -0
  463. data/vendor/test/cases/regression.153.css +8 -0
  464. data/vendor/test/cases/regression.153.styl +9 -0
  465. data/vendor/test/cases/regression.154.css +8 -0
  466. data/vendor/test/cases/regression.154.styl +14 -0
  467. data/vendor/test/cases/regression.156.css +4 -0
  468. data/vendor/test/cases/regression.156.styl +6 -0
  469. data/vendor/test/cases/regression.212.css +15 -0
  470. data/vendor/test/cases/regression.212.styl +14 -0
  471. data/vendor/test/cases/regression.216.css +10 -0
  472. data/vendor/test/cases/regression.216.styl +8 -0
  473. data/vendor/test/cases/regression.220.css +5 -0
  474. data/vendor/test/cases/regression.220.styl +5 -0
  475. data/vendor/test/cases/regression.229.css +12 -0
  476. data/vendor/test/cases/regression.229.styl +9 -0
  477. data/vendor/test/cases/regression.233.css +6 -0
  478. data/vendor/test/cases/regression.233.styl +7 -0
  479. data/vendor/test/cases/regression.235.css +11 -0
  480. data/vendor/test/cases/regression.235.styl +13 -0
  481. data/vendor/test/cases/regression.243.css +3 -0
  482. data/vendor/test/cases/regression.243.styl +4 -0
  483. data/vendor/test/cases/regression.244.css +3 -0
  484. data/vendor/test/cases/regression.244.styl +3 -0
  485. data/vendor/test/cases/regression.247.css +6 -0
  486. data/vendor/test/cases/regression.247.styl +6 -0
  487. data/vendor/test/cases/regression.248.compressed.css +4 -0
  488. data/vendor/test/cases/regression.248.compressed.styl +10 -0
  489. data/vendor/test/cases/regression.252.css +13 -0
  490. data/vendor/test/cases/regression.252.styl +13 -0
  491. data/vendor/test/cases/regression.260.css +6 -0
  492. data/vendor/test/cases/regression.260.styl +6 -0
  493. data/vendor/test/cases/regression.267.css +3 -0
  494. data/vendor/test/cases/regression.267.styl +3 -0
  495. data/vendor/test/cases/regression.270.css +5 -0
  496. data/vendor/test/cases/regression.270.styl +7 -0
  497. data/vendor/test/cases/regression.272.css +11 -0
  498. data/vendor/test/cases/regression.272.styl +17 -0
  499. data/vendor/test/cases/regression.274.css +14 -0
  500. data/vendor/test/cases/regression.274.styl +16 -0
  501. data/vendor/test/cases/regression.360.css +19 -0
  502. data/vendor/test/cases/regression.360.styl +1 -0
  503. data/vendor/test/cases/regression.368.css +4 -0
  504. data/vendor/test/cases/regression.368.styl +3 -0
  505. data/vendor/test/cases/regression.379.css +6 -0
  506. data/vendor/test/cases/regression.379.styl +10 -0
  507. data/vendor/test/cases/regression.380.css +8 -0
  508. data/vendor/test/cases/regression.380.styl +14 -0
  509. data/vendor/test/cases/regression.388.css +2 -0
  510. data/vendor/test/cases/regression.388.styl +6 -0
  511. data/vendor/test/cases/regression.415.css +5 -0
  512. data/vendor/test/cases/regression.415.styl +3 -0
  513. data/vendor/test/cases/regression.420.css +21 -0
  514. data/vendor/test/cases/regression.420.styl +29 -0
  515. data/vendor/test/cases/reset.css +70 -0
  516. data/vendor/test/cases/reset.styl +16 -0
  517. data/vendor/test/cases/rule.charset.css +1 -0
  518. data/vendor/test/cases/rule.charset.styl +2 -0
  519. data/vendor/test/cases/rulset.css +4 -0
  520. data/vendor/test/cases/rulset.newline.css +5 -0
  521. data/vendor/test/cases/rulset.newline.styl +5 -0
  522. data/vendor/test/cases/rulset.styl +3 -0
  523. data/vendor/test/cases/scope.complex.css +10 -0
  524. data/vendor/test/cases/scope.complex.styl +16 -0
  525. data/vendor/test/cases/scope.css +5 -0
  526. data/vendor/test/cases/scope.nested.css +9 -0
  527. data/vendor/test/cases/scope.nested.styl +10 -0
  528. data/vendor/test/cases/scope.styl +12 -0
  529. data/vendor/test/cases/selector.interpolation.css +57 -0
  530. data/vendor/test/cases/selector.interpolation.styl +45 -0
  531. data/vendor/test/cases/selectors.complex.css +28 -0
  532. data/vendor/test/cases/selectors.complex.styl +27 -0
  533. data/vendor/test/cases/selectors.css +50 -0
  534. data/vendor/test/cases/selectors.nested.comma.css +9 -0
  535. data/vendor/test/cases/selectors.nested.comma.styl +8 -0
  536. data/vendor/test/cases/selectors.nested.css +34 -0
  537. data/vendor/test/cases/selectors.nested.styl +33 -0
  538. data/vendor/test/cases/selectors.pseudo.css +27 -0
  539. data/vendor/test/cases/selectors.pseudo.elements.css +26 -0
  540. data/vendor/test/cases/selectors.pseudo.elements.styl +29 -0
  541. data/vendor/test/cases/selectors.pseudo.styl +24 -0
  542. data/vendor/test/cases/selectors.styl +46 -0
  543. data/vendor/test/cases/self-assignment.css +3 -0
  544. data/vendor/test/cases/self-assignment.styl +4 -0
  545. data/vendor/test/cases/vargs.call.css +24 -0
  546. data/vendor/test/cases/vargs.call.styl +40 -0
  547. data/vendor/test/cases/vargs.css +30 -0
  548. data/vendor/test/cases/vargs.styl +49 -0
  549. data/vendor/test/cases/variable.css +3 -0
  550. data/vendor/test/cases/variable.styl +4 -0
  551. data/vendor/test/cases/variables.css +12 -0
  552. data/vendor/test/cases/variables.styl +17 -0
  553. data/vendor/test/images/gif +0 -0
  554. data/vendor/test/images/squirrel.jpeg +0 -0
  555. data/vendor/test/images/tux.png +0 -0
  556. data/vendor/test/run.js +151 -0
  557. data/vendor/testing/index.html +56 -0
  558. data/vendor/testing/stylus.js +146 -0
  559. data/vendor/testing/test-js.js +23 -0
  560. data/vendor/testing/test.css +8 -0
  561. data/vendor/testing/test.js +23 -0
  562. data/vendor/testing/test.styl +75 -0
  563. data/vendor/testing/utils.styl +6 -0
  564. data/vendor/testing/vendor.styl +3 -0
  565. metadata +565 -112
  566. data/.DS_Store +0 -0
  567. data/lib/.DS_Store +0 -0
  568. data/lib/node_modules/cssom/.idea/CSSOM.iml +0 -9
  569. data/lib/node_modules/cssom/.idea/dictionaries/nv.xml +0 -3
  570. data/lib/node_modules/cssom/.idea/encodings.xml +0 -5
  571. data/lib/node_modules/cssom/.idea/misc.xml +0 -17
  572. data/lib/node_modules/cssom/.idea/modules.xml +0 -9
  573. data/lib/node_modules/cssom/.idea/projectCodeStyle.xml +0 -82
  574. data/lib/node_modules/cssom/.idea/vcs.xml +0 -8
  575. data/lib/node_modules/cssom/.idea/workspace.xml +0 -467
  576. data/lib/node_modules/cssom/.livereload +0 -19
  577. data/lib/node_modules/cssom/docs/.livereload +0 -19
@@ -0,0 +1,30 @@
1
+ ## Data URI Image Inlining
2
+
3
+ Stylus is bundled with an optional function named `url()`, which replaces the literal `url()` calls, and conditionally inlines them using base64 [Data URIs](http://en.wikipedia.org/wiki/Data_URI_scheme).
4
+
5
+ ### Example
6
+
7
+ The function itself is available via `require('stylus').url`, and accepts an options object, returning a function that Stylus calls internally when it sees `url()`.
8
+
9
+ The `.define(name, callback)` method assigned a JavaScript function that can be called from stylus source. In this case we have our images in `./css/images` then we can ignore the `paths` option, since image lookups are performed relative to the file being rendered (by default), we may alter this with the option.
10
+
11
+ stylus(str)
12
+ .set('filename', __dirname + '/css/test.styl')
13
+ .define('url', stylus.url())
14
+ .render(function(err, css){
15
+
16
+ });
17
+
18
+ For example if our images live in `./public/images` and we wish to use `url(images/tobi.png)`, we can pass `paths` with our public directory, which will become part of the lookup process. Like-wise if we wanted `url(tobi.png)` instead, we would pass `paths: [__dirname + '/public/images']`.
19
+
20
+ stylus(str)
21
+ .set('filename', __dirname + '/css/test.styl')
22
+ .define('url', stylus.url({ paths: [__dirname + '/public'] }))
23
+ .render(function(err, css){
24
+
25
+ });
26
+
27
+ ### Options
28
+
29
+ - `limit` bytesize limit defaulting to 30Kb (30000)
30
+ - `paths` image resolution path(s)
@@ -0,0 +1,24 @@
1
+ ## gedit language-spec
2
+
3
+ Stylus ships with a temporary version of `styl.lang` for [GtkSourceView](http://live.gnome.org/GtkSourceView), based off [Yanekk](https://github.com/yanekk)'s [work](https://github.com/gmate/gmate/blob/master/lang-specs/scss.lang) on `scss.lang`.
4
+
5
+ ![Stylus Language Specification for GtkSourceView](http://i.imgur.com/uBppL.png))
6
+
7
+ This is a start and provides a basic [language spec](http://live.gnome.org/Gedit/NewLanguage) for GtkSourceView editors such as [gedit](http://projects.gnome.org/gedit/).
8
+
9
+ **Installation Steps**
10
+
11
+ Download `styl.lang` to your local `language-specs` folder:
12
+
13
+ mkdir -p ~/.local/share/gtksourceview-2.0/language-specs/ && wget https://raw.github.com/LearnBoost/stylus/master/editors/gedit/styl.lang -O ~/.local/share/gtksourceview-2.0/language-specs/styl.lang
14
+
15
+ Update the mime database and enjoy Stylus syntax in gedit!
16
+
17
+ cd ~/.local/share
18
+ update-mime-database mime
19
+
20
+ This is much more enjoyable than having gedit recognize your `.styl` files as Apache Confs!
21
+
22
+ ---
23
+
24
+ **Have a sweet tooth?** Add more icing to gedit with gedit-icing: [https://github.com/niftylettuce/gedit-icing](https://github.com/niftylettuce/gedit-icing)
@@ -0,0 +1,73 @@
1
+ ## Import
2
+
3
+ Stylus supports both literal __@import__ for CSS, as well as dynamic importing of other Stylus sheets.
4
+
5
+ ### Literal CSS
6
+
7
+ Any filename with the extension `.css` will become a literal, for example:
8
+
9
+ @import "reset.css"
10
+
11
+ will render to the literal css __@import__ shown below:
12
+
13
+ @import "reset.css"
14
+
15
+ ### Stylus Import
16
+
17
+ When using __@import__ without the `.css` extension, it is assumed to be a Stylus sheet, for example `@import "mixins/border-radius"`.
18
+
19
+ __@import__ works by iterating an array of directories, and seeing if this file lives in any of them, similar to node's `require.paths`. This array defaults to a single path which is derived from the `filename` option's dirname. So if your filename is `/tmp/testing/stylus/main.styl`, then import will look in `/tmp/testing/stylus/`.
20
+
21
+ __@import__ also supports index styles, meaning if you `@import blueprint`, it will resolve either `blueprint.styl` or `blueprint/index.styl`, useful for libraries to expose all of their features, but still allow a subset of the library to be imported. For example a common lib structure might be:
22
+
23
+ ./tablet
24
+ |-- index.styl
25
+ |-- vendor.styl
26
+ |-- buttons.styl
27
+ |-- images.styl
28
+
29
+ In the example below we set the `paths` options to provide additional paths to Stylus. Within `./test.styl` we could then `@import "mixins/border-radius"` or `@import "border-radius"` since `./mixins` is exposed to Stylus.
30
+
31
+ /**
32
+ * Module dependencies.
33
+ */
34
+
35
+ var stylus = require('../')
36
+ , str = require('fs').readFileSync(__dirname + '/test.styl', 'utf8');
37
+
38
+ var paths = [
39
+ __dirname
40
+ , __dirname + '/mixins'
41
+ ];
42
+
43
+ stylus(str)
44
+ .set('filename', __dirname + '/test.styl')
45
+ .set('paths', paths)
46
+ .render(function(err, css){
47
+ if (err) throw err;
48
+ console.log(css);
49
+ });
50
+
51
+ ### JavaScript Import API
52
+
53
+ When using the `.import(path)` method, these imports are deferred until evaluation:
54
+
55
+ var stylus = require('../')
56
+ , str = require('fs').readFileSync(__dirname + '/test.styl', 'utf8');
57
+
58
+ stylus(str)
59
+ .set('filename', __dirname + '/test.styl')
60
+ .import('mixins/vendor')
61
+ .render(function(err, css){
62
+ if (err) throw err;
63
+ console.log(css);
64
+ });
65
+
66
+ The following are essentially equivalent:
67
+
68
+ @import 'mixins/vendor'
69
+
70
+ and
71
+
72
+ .import('mixins/vendor')
73
+
@@ -0,0 +1,55 @@
1
+
2
+ ## Interpolation
3
+
4
+ Stylus supports interpolation by using the `{}` characters to surround an expression, which then becomes part of the identifier. For example `-webkit-{'border' + '-radius'}` would evaluate to `-webkit-border-radius`.
5
+
6
+ A great example use-case for this is expanding properties with vendor prefixes.
7
+
8
+ vendor(prop, args)
9
+ -webkit-{prop} args
10
+ -moz-{prop} args
11
+ {prop} args
12
+
13
+ border-radius()
14
+ vendor('border-radius', arguments)
15
+
16
+ box-shadow()
17
+ vendor('box-shadow', arguments)
18
+
19
+ button
20
+ border-radius 1px 2px / 3px 4px
21
+
22
+ yielding:
23
+
24
+ button {
25
+ -webkit-border-radius: 1px 2px / 3px 4px;
26
+ -moz-border-radius: 1px 2px / 3px 4px;
27
+ border-radius: 1px 2px / 3px 4px;
28
+ }
29
+
30
+ ## Selector Interpolation
31
+
32
+ Interpolation works with selectors as well, for example we may iterate while assigning the `height` property for the first 5 rows in a table as shown below.
33
+
34
+ table
35
+ for row in 1 2 3 4 5
36
+ tr:nth-child({row})
37
+ height: 10px * row
38
+
39
+ yielding:
40
+
41
+ table tr:nth-child(1) {
42
+ height: 10px;
43
+ }
44
+ table tr:nth-child(2) {
45
+ height: 20px;
46
+ }
47
+ table tr:nth-child(3) {
48
+ height: 30px;
49
+ }
50
+ table tr:nth-child(4) {
51
+ height: 40px;
52
+ }
53
+ table tr:nth-child(5) {
54
+ height: 50px;
55
+ }
@@ -0,0 +1,39 @@
1
+
2
+ ## Introspection API
3
+
4
+ Stylus supports an introspection API, allowing mixins and functions to reflect relative to the caller etc.
5
+
6
+
7
+ ## mixin
8
+
9
+ The `mixin` local variable is automatically assigned within function bodies,
10
+ containing the string "root" indicating the function is called at the root
11
+ level, or "block" indicating otherwise, and finally `false` if the function
12
+ is invoked expecting a return value.
13
+
14
+ In the following example we define `reset()` altering its behaviour when mixed in to root, another block, or a return value as used in the `foo` property below.
15
+
16
+ reset()
17
+ if mixin == 'root'
18
+ got
19
+ root true
20
+ else if mixin
21
+ got 'a mixin'
22
+ else
23
+ 'not a mixin'
24
+
25
+ reset()
26
+
27
+ body
28
+ reset()
29
+ foo reset()
30
+
31
+ compiles to:
32
+
33
+ got {
34
+ root: true;
35
+ }
36
+ body {
37
+ foo: "not a mixin";
38
+ got: "a mixin";
39
+ }
@@ -0,0 +1,100 @@
1
+
2
+ ## Iteration
3
+
4
+ Stylus allows you to iterate expressions via the `for/in` construct, taking the form of:
5
+
6
+ for <val-name> [, <key-name>] in <expression>
7
+
8
+ For example:
9
+
10
+ body
11
+ for num in 1 2 3
12
+ foo num
13
+
14
+ yields:
15
+
16
+ body {
17
+ foo: 1;
18
+ foo: 2;
19
+ foo: 3;
20
+ }
21
+
22
+ The example below shows how to use the `<key-name>`:
23
+
24
+ body
25
+ fonts = Impact Arial sans-serif
26
+ for font, i in fonts
27
+ foo i font
28
+
29
+ yielding:
30
+
31
+ body {
32
+ foo: 0 Impact;
33
+ foo: 1 Arial;
34
+ foo: 2 sans-serif;
35
+ }
36
+
37
+ ### Mixins
38
+
39
+ We may utilize iteration within mixins to produce powerful functionality, for example we can apply expression pairs as properties using interpolation and iteration. Below we define `apply()`, conditionally utilizing all the `arguments` so that comma-delimited _and_ expression lists are supported:
40
+
41
+ apply(props)
42
+ props = arguments if length(arguments) > 1
43
+ for prop in props
44
+ {prop[0]} prop[1]
45
+
46
+ body
47
+ apply(one 1, two 2, three 3)
48
+
49
+ body
50
+ list = (one 1) (two 2) (three 3)
51
+ apply(list)
52
+
53
+ ### Functions
54
+
55
+ Stylus functions may also contain for-loops, below are some example use-cases:
56
+
57
+ sum:
58
+
59
+ sum(nums)
60
+ sum = 0
61
+ for n in nums
62
+ sum += n
63
+
64
+ sum(1 2 3)
65
+ // => 6
66
+
67
+ join:
68
+
69
+ join(delim, args)
70
+ buf = ''
71
+ for arg, index in args
72
+ if index
73
+ buf += delim + arg
74
+ else
75
+ buf += arg
76
+
77
+ join(', ', foo bar baz)
78
+ // => "foo, bar, baz"
79
+
80
+ ### Postfix
81
+
82
+ Much like `if` / `unless` may be utilized post-statement, the same can be done with `for`. Below are the same examples as above utilizing the postfix syntax:
83
+
84
+ sum(nums)
85
+ sum = 0
86
+ sum += n for n in nums
87
+
88
+
89
+ join(delim, args)
90
+ buf = ''
91
+ buf += i ? delim + arg : arg for arg, i in args
92
+
93
+ We can also __return__ from within a loop, below is an example returning the
94
+ number when `n % 2 == 0` evaluates to __true__.
95
+
96
+ first-even(nums)
97
+ return n if n % 2 == 0 for n in nums
98
+
99
+ first-even(1 3 5 5 6 3 2)
100
+ // => 6
data/vendor/docs/js.md ADDED
@@ -0,0 +1,136 @@
1
+ ## JavaScript API
2
+
3
+ Simply require the module, and call `render()` with the given string of stylus code, and (optional) options object. Frameworks utilizing stylus should pass the `filename` option to provide better error reporting.
4
+
5
+ var stylus = require('stylus');
6
+
7
+ stylus.render(str, { filename: 'nesting.css' }, function(err, css){
8
+ if (err) throw err;
9
+ console.log(css);
10
+ });
11
+
12
+ We can also do the same thing in a more progressive manner:
13
+
14
+ var stylus = require('stylus');
15
+
16
+ stylus(str)
17
+ .set('filename', 'nesting.css')
18
+ .render(function(err, css){
19
+ // logic
20
+ });
21
+
22
+ ### .set(setting, value)
23
+
24
+ Apply a setting such as a `filename`, or import `paths`:
25
+
26
+ .set('filename', __dirname + '/test.styl')
27
+ .set('paths', [__dirname, __dirname + '/mixins'])
28
+
29
+ ### .include(path)
30
+
31
+ A progressive alternative to setting `paths` via `.set()`, which is ideal when exposing external stylus libraries which expose a path.
32
+
33
+ stylus(str)
34
+ .include(require('nib').path)
35
+ .include(process.env.HOME + '/mixins')
36
+ .render(...)
37
+
38
+ ### .import(path)
39
+
40
+ Defer importing of the given `path` until evaluation is performed. The example below is essentially the same as doing `@import 'mixins/vendor'` within your Stylus sheet.
41
+
42
+ var stylus = require('../')
43
+ , str = require('fs').readFileSync(__dirname + '/test.styl', 'utf8');
44
+
45
+ stylus(str)
46
+ .set('filename', __dirname + '/test.styl')
47
+ .import('mixins/vendor')
48
+ .render(function(err, css){
49
+ if (err) throw err;
50
+ console.log(css);
51
+ });
52
+
53
+ ### .define(name, node)
54
+
55
+ By passing a `Node`, we may define a global variable. This is useful when exposing conditional features within your library depending on the availability of another. For example the "Nib" extensions library conditionally supports node-canvas, providing image generation, however this is not always available, so Nib may define:
56
+
57
+ .define('has-canvas', stylus.nodes.false);
58
+
59
+ ### .define(name, fn)
60
+
61
+ This method allows you to provide a JavaScript-defined function to Stylus, think of these as you would JavaScript to C++ bindings. When you have something you cannot do within Stylus, you define it in JavaScript.
62
+
63
+ In our example we define four functions `add()`, `sub()`, `image-width()`, and `image-height()`. These functions must return a `Node`, this constructor and the other nodes are available via `stylus.nodes`.
64
+
65
+ var stylus = require('../')
66
+ , nodes = stylus.nodes
67
+ , utils = stylus.utils
68
+ , fs = require('fs');
69
+
70
+ function add(a, b) {
71
+ return a.operate('+', b);
72
+ }
73
+
74
+ function sub(a, b) {
75
+ return a.operate('-', b);
76
+ }
77
+
78
+ function imageDimensions(img) {
79
+ // assert that the node (img) is a String node, passing
80
+ // the param name for error reporting
81
+ utils.assertType(img, 'string', 'img');
82
+ var path = img.val;
83
+
84
+ // Grab bytes necessary to retrieve dimensions.
85
+ // if this was real you would do this per format,
86
+ // instead of reading the entire image :)
87
+ var data = fs.readFileSync(__dirname + '/' + path);
88
+
89
+ // GIF
90
+ // of course you would support.. more :)
91
+ if ('GIF' == data.slice(0, 3).toString()) {
92
+ var w = data.slice(6, 8)
93
+ , h = data.slice(8, 10);
94
+ w = w[1] << 8 | w[0];
95
+ h = h[1] << 8 | h[0];
96
+ }
97
+
98
+ return [w, h];
99
+ }
100
+
101
+ function imageWidth(img) {
102
+ return new nodes.Unit(imageDimensions(img)[0]);
103
+ }
104
+
105
+ function imageHeight(img) {
106
+ return new nodes.Unit(imageDimensions(img)[1]);
107
+ }
108
+
109
+ stylus(str)
110
+ .set('filename', 'js-functions.styl')
111
+ .define('add', add)
112
+ .define('sub', sub)
113
+ .define('image-width', imageWidth)
114
+ .define('image-height', imageHeight)
115
+ .render(function(err, css){
116
+ if (err) throw err;
117
+ console.log(css);
118
+ });
119
+
120
+ For further reference until documentation is complete please reference the following files:
121
+
122
+ - lib/nodes/*
123
+ - lib/utils.js
124
+
125
+ ### .use(fn)
126
+
127
+ When called, the given `fn` is invoked with the renderer, allowing all of the methods above to be used. This allows for plugins to easily expose themselves, defining functions, paths etc.
128
+
129
+ var mylib = function(style){
130
+ style.define('add', add);
131
+ style.define('sub', sub);
132
+ };
133
+
134
+ stylus(str)
135
+ .use(mylib)
136
+ .render(...)
@@ -0,0 +1,120 @@
1
+
2
+ ## @keyframes
3
+
4
+ Stylus supports the `@keyframes` at-rule, which is converted to `@-webkit-keyframes` when compiled:
5
+
6
+
7
+ @keyframes pulse
8
+ 0%
9
+ background-color red
10
+ opacity 1.0
11
+ -webkit-transform scale(1.0) rotate(0deg)
12
+ 33%
13
+ background-color blue
14
+ opacity 0.75
15
+ -webkit-transform scale(1.1) rotate(-5deg)
16
+ 67%
17
+ background-color green
18
+ opacity 0.5
19
+ -webkit-transform scale(1.1) rotate(5deg)
20
+ 100%
21
+ background-color red
22
+ opacity 1.0
23
+ -webkit-transform scale(1.0) rotate(0deg)
24
+
25
+ yielding:
26
+
27
+ @-webkit-keyframes pulse {
28
+ 0% {
29
+ background-color: red;
30
+ opacity: 1;
31
+ -webkit-transform: scale(1) rotate(0deg);
32
+ }
33
+
34
+ 33% {
35
+ background-color: blue;
36
+ opacity: 0.75;
37
+ -webkit-transform: scale(1.1) rotate(-5deg);
38
+ }
39
+
40
+ 67% {
41
+ background-color: green;
42
+ opacity: 0.5;
43
+ -webkit-transform: scale(1.1) rotate(5deg);
44
+ }
45
+
46
+ 100% {
47
+ background-color: red;
48
+ opacity: 1;
49
+ -webkit-transform: scale(1) rotate(0deg);
50
+ }
51
+
52
+ }
53
+
54
+ ## Expansion
55
+
56
+ By utilizing `@keyframes` your rules are automatically expanded to the vendor prefixes defined by the `vendors` variable, defaulting to `webkit moz official`. This means we can alter it at any time for the expansion to take effect immediately. For example consider the following
57
+
58
+ @keyframes foo {
59
+ from {
60
+ color: black
61
+ }
62
+ to {
63
+ color: white
64
+ }
65
+ }
66
+
67
+ expands to our two default vendors and the official syntax:
68
+
69
+ @-moz-keyframes foo {
70
+ 0% {
71
+ color: #000;
72
+ }
73
+
74
+ 100% {
75
+ color: #fff;
76
+ }
77
+ }
78
+ @-webkit-keyframes foo {
79
+ 0% {
80
+ color: #000;
81
+ }
82
+
83
+ 100% {
84
+ color: #fff;
85
+ }
86
+ }
87
+ @keyframes foo {
88
+ 0% {
89
+ color: #000;
90
+ }
91
+
92
+ 100% {
93
+ color: #fff;
94
+ }
95
+ }
96
+
97
+ if we wanted to limit to the official syntax only, simply alter `vendors`:
98
+
99
+ vendors = official
100
+
101
+ @keyframes foo {
102
+ from {
103
+ color: black
104
+ }
105
+ to {
106
+ color: white
107
+ }
108
+ }
109
+
110
+ yielding:
111
+
112
+ @keyframes foo {
113
+ 0% {
114
+ color: #000;
115
+ }
116
+
117
+ 100% {
118
+ color: #fff;
119
+ }
120
+ }
@@ -0,0 +1,35 @@
1
+
2
+ ## Keyword Arguments
3
+
4
+ Stylus supports keyword arguments, or "kwargs", allowing you to key
5
+ arguments by their associated parameter name.
6
+
7
+ The examples shown below are functionally equivalent, however we can
8
+ place keyword arguments anywhere within the list. The remaining arguments
9
+ that are _not_ keyed will be applied to the parameters that have not
10
+ been satisfied.
11
+
12
+ body {
13
+ color: rgba(255, 200, 100, 0.5);
14
+ color: rgba(red: 255, green: 200, blue: 100, alpha: 0.5);
15
+ color: rgba(alpha: 0.5, blue: 100, red: 255, 200);
16
+ color: rgba(alpha: 0.5, blue: 100, 255, 200);
17
+ }
18
+
19
+ yielding:
20
+
21
+ body {
22
+ color: rgba(255,200,100,0.5);
23
+ color: rgba(255,200,100,0.5);
24
+ color: rgba(255,200,100,0.5);
25
+ color: rgba(255,200,100,0.5);
26
+ }
27
+
28
+
29
+ To see what parameters a function or mixin accept, use the `p()` function:
30
+
31
+ p(rgba)
32
+
33
+ yielding:
34
+
35
+ inspect: rgba(red, green, blue, alpha)
@@ -0,0 +1,16 @@
1
+ ## Literal CSS
2
+
3
+ If for any reason Stylus cannot accommodate a specific need, you can always resort to literal css via `@css`:
4
+
5
+
6
+ @css {
7
+ body {
8
+ font: 14px;
9
+ }
10
+ }
11
+
12
+ compiling to:
13
+
14
+ body {
15
+ font: 14px;
16
+ }
@@ -0,0 +1,18 @@
1
+
2
+ ## @media
3
+
4
+ The `@media` works just as it does within regular css, however with Stylus block notation:
5
+
6
+ @media print
7
+ #header
8
+ #footer
9
+ display none
10
+
11
+ yielding:
12
+
13
+ @media print {
14
+ #header,
15
+ #footer {
16
+ display: none;
17
+ }
18
+ }