stylus-source 0.15.4 → 0.17.0
Sign up to get free protection for your applications and to get access to all the features.
- data/.gitignore +1 -0
- data/Rakefile +39 -0
- data/VERSION +1 -0
- data/lib/stylus/source.rb +1 -1
- data/stylus-source.gemspec +2 -2
- data/vendor/History.md +525 -0
- data/vendor/LICENSE +22 -0
- data/vendor/Makefile +20 -0
- data/vendor/Readme.md +127 -0
- data/vendor/bin/stylus +606 -0
- data/vendor/bm.js +22 -0
- data/vendor/docs/bifs.md +582 -0
- data/vendor/docs/comments.md +35 -0
- data/vendor/docs/compare.md +81 -0
- data/vendor/docs/conditionals.md +107 -0
- data/vendor/docs/css-style.md +77 -0
- data/vendor/docs/error-reporting.md +50 -0
- data/vendor/docs/escape.md +27 -0
- data/vendor/docs/executable.md +159 -0
- data/vendor/docs/firebug.md +60 -0
- data/vendor/docs/font-face.md +26 -0
- data/vendor/docs/functions.md +192 -0
- data/vendor/docs/functions.url.md +30 -0
- data/vendor/docs/gedit.md +24 -0
- data/vendor/docs/import.md +73 -0
- data/vendor/docs/interpolation.md +55 -0
- data/vendor/docs/introspection.md +39 -0
- data/vendor/docs/iteration.md +100 -0
- data/vendor/docs/js.md +136 -0
- data/vendor/docs/keyframes.md +120 -0
- data/vendor/docs/kwargs.md +35 -0
- data/vendor/docs/literal.md +16 -0
- data/vendor/docs/media.md +18 -0
- data/vendor/docs/middleware.md +73 -0
- data/vendor/docs/mixins.md +130 -0
- data/vendor/docs/operators.md +451 -0
- data/vendor/docs/selectors.md +131 -0
- data/vendor/docs/textmate.md +4 -0
- data/vendor/docs/vargs.md +84 -0
- data/vendor/docs/variables.md +78 -0
- data/vendor/editors/Stylus.tmbundle/Commands/Compile and Display CSS.tmCommand +33 -0
- data/vendor/editors/Stylus.tmbundle/Preferences/Comments.tmPreferences +36 -0
- data/vendor/editors/Stylus.tmbundle/Syntaxes/Stylus.tmLanguage +166 -0
- data/vendor/editors/Stylus.tmbundle/info.plist +10 -0
- data/vendor/editors/gedit/styl.lang +475 -0
- data/vendor/examples/arithmetic.js +12 -0
- data/vendor/examples/arithmetic.styl +29 -0
- data/vendor/examples/basic.js +12 -0
- data/vendor/examples/basic.styl +8 -0
- data/vendor/examples/builtins.js +12 -0
- data/vendor/examples/builtins.styl +56 -0
- data/vendor/examples/comments.js +11 -0
- data/vendor/examples/comments.styl +15 -0
- data/vendor/examples/compress.js +12 -0
- data/vendor/examples/conversions.js +12 -0
- data/vendor/examples/conversions.styl +34 -0
- data/vendor/examples/functions.js +12 -0
- data/vendor/examples/functions.styl +30 -0
- data/vendor/examples/gradients.js +13 -0
- data/vendor/examples/gradients.styl +8 -0
- data/vendor/examples/images/gopher.jpg +0 -0
- data/vendor/examples/images/gradient.svg +9 -0
- data/vendor/examples/images/jesus.gif +0 -0
- data/vendor/examples/images/sprite.gif +0 -0
- data/vendor/examples/images.js +20 -0
- data/vendor/examples/images.styl +15 -0
- data/vendor/examples/implicit-functions.js +12 -0
- data/vendor/examples/implicit-functions.styl +23 -0
- data/vendor/examples/import.js +12 -0
- data/vendor/examples/import.styl +11 -0
- data/vendor/examples/js-functions.js +55 -0
- data/vendor/examples/js-functions.styl +23 -0
- data/vendor/examples/literal.js +12 -0
- data/vendor/examples/literal.styl +8 -0
- data/vendor/examples/middleware.js +23 -0
- data/vendor/examples/mixins/box.styl +14 -0
- data/vendor/examples/mixins/gradients.styl +92 -0
- data/vendor/examples/nesting.js +12 -0
- data/vendor/examples/nesting.styl +14 -0
- data/vendor/examples/variables.js +12 -0
- data/vendor/examples/variables.styl +24 -0
- data/vendor/index.js +2 -0
- data/{lib/stylus → vendor/lib}/colors.js +0 -0
- data/{lib/stylus → vendor/lib}/convert/css.js +0 -0
- data/{lib/stylus → vendor/lib}/errors.js +0 -0
- data/{lib/stylus → vendor/lib}/functions/image.js +0 -0
- data/{lib/stylus → vendor/lib}/functions/index.js +0 -0
- data/{lib/stylus → vendor/lib}/functions/index.styl +11 -2
- data/{lib/stylus → vendor/lib}/functions/url.js +0 -0
- data/{lib/stylus → vendor/lib}/lexer.js +14 -1
- data/{lib/stylus → vendor/lib}/middleware.js +5 -1
- data/{lib/stylus → vendor/lib}/nodes/arguments.js +0 -0
- data/{lib/stylus → vendor/lib}/nodes/binop.js +0 -0
- data/{lib/stylus → vendor/lib}/nodes/block.js +0 -0
- data/{lib/stylus → vendor/lib}/nodes/boolean.js +0 -0
- data/{lib/stylus → vendor/lib}/nodes/call.js +0 -0
- data/{lib/stylus → vendor/lib}/nodes/charset.js +0 -0
- data/{lib/stylus → vendor/lib}/nodes/comment.js +0 -0
- data/{lib/stylus → vendor/lib}/nodes/each.js +0 -0
- data/{lib/stylus → vendor/lib}/nodes/expression.js +32 -0
- data/{lib/stylus → vendor/lib}/nodes/fontface.js +0 -0
- data/{lib/stylus → vendor/lib}/nodes/function.js +0 -0
- data/{lib/stylus → vendor/lib}/nodes/group.js +0 -0
- data/{lib/stylus → vendor/lib}/nodes/hsla.js +0 -0
- data/{lib/stylus → vendor/lib}/nodes/ident.js +0 -0
- data/{lib/stylus → vendor/lib}/nodes/if.js +0 -0
- data/{lib/stylus → vendor/lib}/nodes/import.js +0 -0
- data/{lib/stylus → vendor/lib}/nodes/index.js +0 -0
- data/{lib/stylus → vendor/lib}/nodes/jsliteral.js +0 -0
- data/{lib/stylus → vendor/lib}/nodes/keyframes.js +0 -0
- data/{lib/stylus → vendor/lib}/nodes/literal.js +0 -0
- data/{lib/stylus → vendor/lib}/nodes/media.js +0 -0
- data/{lib/stylus → vendor/lib}/nodes/node.js +14 -0
- data/{lib/stylus → vendor/lib}/nodes/null.js +0 -0
- data/{lib/stylus → vendor/lib}/nodes/page.js +0 -0
- data/{lib/stylus → vendor/lib}/nodes/params.js +0 -0
- data/{lib/stylus → vendor/lib}/nodes/property.js +0 -0
- data/{lib/stylus → vendor/lib}/nodes/return.js +0 -0
- data/{lib/stylus → vendor/lib}/nodes/rgba.js +4 -2
- data/{lib/stylus → vendor/lib}/nodes/root.js +0 -0
- data/{lib/stylus → vendor/lib}/nodes/selector.js +0 -0
- data/{lib/stylus → vendor/lib}/nodes/string.js +0 -0
- data/{lib/stylus → vendor/lib}/nodes/ternary.js +0 -0
- data/{lib/stylus → vendor/lib}/nodes/unaryop.js +0 -0
- data/{lib/stylus → vendor/lib}/nodes/unit.js +0 -0
- data/{lib/stylus → vendor/lib}/parser.js +17 -2
- data/{lib/stylus → vendor/lib}/renderer.js +0 -0
- data/{lib/stylus → vendor/lib}/stack/frame.js +0 -0
- data/{lib/stylus → vendor/lib}/stack/index.js +0 -0
- data/{lib/stylus → vendor/lib}/stack/scope.js +0 -0
- data/{lib/stylus → vendor/lib}/stylus.js +1 -1
- data/{lib/stylus → vendor/lib}/token.js +0 -0
- data/{lib/stylus → vendor/lib}/utils.js +0 -0
- data/{lib/stylus → vendor/lib}/visitor/compiler.js +1 -0
- data/{lib/stylus → vendor/lib}/visitor/evaluator.js +9 -3
- data/{lib/stylus → vendor/lib}/visitor/index.js +0 -0
- data/{lib → vendor}/node_modules/cssom/Jakefile +0 -0
- data/{lib → vendor}/node_modules/cssom/README.mdown +0 -0
- data/{lib → vendor}/node_modules/cssom/Rakefile +0 -0
- data/{lib → vendor}/node_modules/cssom/docs/bar.css +0 -0
- data/{lib → vendor}/node_modules/cssom/docs/demo.css +0 -0
- data/{lib → vendor}/node_modules/cssom/docs/foo.css +0 -0
- data/{lib → vendor}/node_modules/cssom/docs/parse.html +0 -0
- data/{lib → vendor}/node_modules/cssom/docs/parse2.html +0 -0
- data/{lib → vendor}/node_modules/cssom/index.html +0 -0
- data/{lib → vendor}/node_modules/cssom/lib/CSSImportRule.js +0 -0
- data/{lib → vendor}/node_modules/cssom/lib/CSSMediaRule.js +0 -0
- data/{lib → vendor}/node_modules/cssom/lib/CSSOM.js +0 -0
- data/{lib → vendor}/node_modules/cssom/lib/CSSRule.js +0 -0
- data/{lib → vendor}/node_modules/cssom/lib/CSSStyleDeclaration.js +0 -0
- data/{lib → vendor}/node_modules/cssom/lib/CSSStyleRule.js +0 -0
- data/{lib → vendor}/node_modules/cssom/lib/CSSStyleSheet.js +0 -0
- data/{lib → vendor}/node_modules/cssom/lib/MediaList.js +0 -0
- data/{lib → vendor}/node_modules/cssom/lib/StyleSheet.js +0 -0
- data/{lib → vendor}/node_modules/cssom/lib/clone.js +0 -0
- data/{lib → vendor}/node_modules/cssom/lib/index.js +0 -0
- data/{lib → vendor}/node_modules/cssom/lib/parse.js +0 -0
- data/{lib → vendor}/node_modules/cssom/media.html +0 -0
- data/{lib → vendor}/node_modules/cssom/package.json +0 -0
- data/{lib → vendor}/node_modules/cssom/plugins/toHTML.js +0 -0
- data/{lib → vendor}/node_modules/cssom/server/index.html +0 -0
- data/{lib → vendor}/node_modules/cssom/server/index.js +0 -0
- data/{lib → vendor}/node_modules/cssom/shorthands.html +0 -0
- data/{lib → vendor}/node_modules/cssom/test/CSSStyleDeclaration.test.js +0 -0
- data/{lib → vendor}/node_modules/cssom/test/CSSStyleRule.test.js +0 -0
- data/{lib → vendor}/node_modules/cssom/test/CSSStyleSheet.test.js +0 -0
- data/{lib → vendor}/node_modules/cssom/test/MediaList.test.js +0 -0
- data/{lib → vendor}/node_modules/cssom/test/clone.test.js +0 -0
- data/{lib → vendor}/node_modules/cssom/test/fixtures/dummy.css +0 -0
- data/{lib → vendor}/node_modules/cssom/test/helper.js +0 -0
- data/{lib → vendor}/node_modules/cssom/test/index.html +0 -0
- data/{lib → vendor}/node_modules/cssom/test/parse.test.js +0 -0
- data/{lib → vendor}/node_modules/cssom/test/vendor/qunit.css +0 -0
- data/{lib → vendor}/node_modules/cssom/test/vendor/qunit.js +0 -0
- data/{lib → vendor}/node_modules/growl/History.md +0 -0
- data/{lib → vendor}/node_modules/growl/Readme.md +0 -0
- data/{lib → vendor}/node_modules/growl/lib/growl.js +0 -0
- data/{lib → vendor}/node_modules/growl/package.json +0 -0
- data/{lib → vendor}/node_modules/growl/test.js +0 -0
- data/vendor/node_modules/mkdirp/LICENSE +21 -0
- data/vendor/node_modules/mkdirp/README.markdown +21 -0
- data/vendor/node_modules/mkdirp/examples/pow.js +6 -0
- data/vendor/node_modules/mkdirp/examples/pow.js.orig +6 -0
- data/vendor/node_modules/mkdirp/examples/pow.js.rej +19 -0
- data/vendor/node_modules/mkdirp/index.js +20 -0
- data/vendor/node_modules/mkdirp/package.json +23 -0
- data/vendor/node_modules/mkdirp/test/mkdirp.js +28 -0
- data/vendor/node_modules/mkdirp/test/race.js +41 -0
- data/vendor/node_modules/mkdirp/test/rel.js +32 -0
- data/vendor/package.json +16 -0
- data/vendor/test/cases/arithmetic.color.css +44 -0
- data/vendor/test/cases/arithmetic.color.styl +48 -0
- data/vendor/test/cases/arithmetic.css +23 -0
- data/vendor/test/cases/arithmetic.styl +30 -0
- data/vendor/test/cases/arithmetic.unary.css +16 -0
- data/vendor/test/cases/arithmetic.unary.styl +16 -0
- data/vendor/test/cases/atscope.css +21 -0
- data/vendor/test/cases/atscope.styl +23 -0
- data/vendor/test/cases/bifs.add-property.css +21 -0
- data/vendor/test/cases/bifs.add-property.styl +48 -0
- data/vendor/test/cases/bifs.components.css +9 -0
- data/vendor/test/cases/bifs.components.styl +9 -0
- data/vendor/test/cases/bifs.dark.css +5 -0
- data/vendor/test/cases/bifs.dark.styl +4 -0
- data/vendor/test/cases/bifs.darken.css +8 -0
- data/vendor/test/cases/bifs.darken.styl +9 -0
- data/vendor/test/cases/bifs.fade.css +6 -0
- data/vendor/test/cases/bifs.fade.styl +6 -0
- data/vendor/test/cases/bifs.image-size.css +9 -0
- data/vendor/test/cases/bifs.image-size.styl +16 -0
- data/vendor/test/cases/bifs.join.css +18 -0
- data/vendor/test/cases/bifs.join.styl +21 -0
- data/vendor/test/cases/bifs.last.css +5 -0
- data/vendor/test/cases/bifs.last.styl +6 -0
- data/vendor/test/cases/bifs.length.css +10 -0
- data/vendor/test/cases/bifs.length.styl +18 -0
- data/vendor/test/cases/bifs.light.css +5 -0
- data/vendor/test/cases/bifs.light.styl +4 -0
- data/vendor/test/cases/bifs.lighten.css +14 -0
- data/vendor/test/cases/bifs.lighten.styl +14 -0
- data/vendor/test/cases/bifs.lookup.css +3 -0
- data/vendor/test/cases/bifs.lookup.styl +8 -0
- data/vendor/test/cases/bifs.match.css +4 -0
- data/vendor/test/cases/bifs.match.styl +9 -0
- data/vendor/test/cases/bifs.opposite-position.css +8 -0
- data/vendor/test/cases/bifs.opposite-position.styl +9 -0
- data/vendor/test/cases/bifs.push.css +25 -0
- data/vendor/test/cases/bifs.push.styl +48 -0
- data/vendor/test/cases/bifs.rgba.css +5 -0
- data/vendor/test/cases/bifs.rgba.styl +4 -0
- data/vendor/test/cases/bifs.s.css +11 -0
- data/vendor/test/cases/bifs.s.styl +12 -0
- data/vendor/test/cases/bifs.type.css +11 -0
- data/vendor/test/cases/bifs.type.styl +12 -0
- data/vendor/test/cases/bifs.unit.css +6 -0
- data/vendor/test/cases/bifs.unit.styl +5 -0
- data/vendor/test/cases/bifs.unquote.css +5 -0
- data/vendor/test/cases/bifs.unquote.styl +8 -0
- data/vendor/test/cases/bifs.url.css +11 -0
- data/vendor/test/cases/bifs.url.styl +15 -0
- data/vendor/test/cases/coercion.css +6 -0
- data/vendor/test/cases/coercion.styl +5 -0
- data/vendor/test/cases/comments.css +18 -0
- data/vendor/test/cases/comments.styl +28 -0
- data/vendor/test/cases/compress.comments.css +2 -0
- data/vendor/test/cases/compress.comments.styl +5 -0
- data/vendor/test/cases/compress.units.css +2 -0
- data/vendor/test/cases/compress.units.styl +18 -0
- data/vendor/test/cases/conditional-assignment.css +4 -0
- data/vendor/test/cases/conditional-assignment.styl +9 -0
- data/vendor/test/cases/control.blueprint.ie.css +126 -0
- data/vendor/test/cases/control.blueprint.ie.styl +36 -0
- data/vendor/test/cases/control.blueprint.screen.css +1103 -0
- data/vendor/test/cases/control.blueprint.screen.styl +265 -0
- data/vendor/test/cases/control.boilerplate.css +473 -0
- data/vendor/test/cases/control.boilerplate.styl +265 -0
- data/vendor/test/cases/css.functions.single-line.css +9 -0
- data/vendor/test/cases/css.functions.single-line.styl +13 -0
- data/vendor/test/cases/css.if.css +8 -0
- data/vendor/test/cases/css.if.styl +21 -0
- data/vendor/test/cases/css.keyframes.css +57 -0
- data/vendor/test/cases/css.keyframes.styl +48 -0
- data/vendor/test/cases/css.large.css +172 -0
- data/vendor/test/cases/css.large.styl +172 -0
- data/vendor/test/cases/css.media.css +15 -0
- data/vendor/test/cases/css.media.styl +17 -0
- data/vendor/test/cases/css.mixins.braces.css +38 -0
- data/vendor/test/cases/css.mixins.braces.styl +53 -0
- data/vendor/test/cases/css.mixins.css +38 -0
- data/vendor/test/cases/css.mixins.root.css +26 -0
- data/vendor/test/cases/css.mixins.root.styl +25 -0
- data/vendor/test/cases/css.mixins.root.wonky.css +26 -0
- data/vendor/test/cases/css.mixins.root.wonky.styl +17 -0
- data/vendor/test/cases/css.mixins.styl +47 -0
- data/vendor/test/cases/css.selector.interpolation.css +91 -0
- data/vendor/test/cases/css.selector.interpolation.styl +90 -0
- data/vendor/test/cases/css.selectors.css +38 -0
- data/vendor/test/cases/css.selectors.styl +53 -0
- data/vendor/test/cases/css.whitespace.css +37 -0
- data/vendor/test/cases/css.whitespace.styl +38 -0
- data/vendor/test/cases/escape.css +4 -0
- data/vendor/test/cases/escape.styl +4 -0
- data/vendor/test/cases/fontface.css +4 -0
- data/vendor/test/cases/fontface.styl +5 -0
- data/vendor/test/cases/for.complex.css +44 -0
- data/vendor/test/cases/for.complex.styl +28 -0
- data/vendor/test/cases/for.css +52 -0
- data/vendor/test/cases/for.function.css +20 -0
- data/vendor/test/cases/for.function.styl +51 -0
- data/vendor/test/cases/for.styl +44 -0
- data/vendor/test/cases/function.arguments.css +4 -0
- data/vendor/test/cases/function.arguments.styl +14 -0
- data/vendor/test/cases/function.literals.css +6 -0
- data/vendor/test/cases/function.literals.styl +12 -0
- data/vendor/test/cases/functions.arg-calls.css +3 -0
- data/vendor/test/cases/functions.arg-calls.styl +9 -0
- data/vendor/test/cases/functions.call.css +4 -0
- data/vendor/test/cases/functions.call.styl +7 -0
- data/vendor/test/cases/functions.css +11 -0
- data/vendor/test/cases/functions.defaults.css +15 -0
- data/vendor/test/cases/functions.defaults.styl +30 -0
- data/vendor/test/cases/functions.multi-line.css +9 -0
- data/vendor/test/cases/functions.multi-line.styl +25 -0
- data/vendor/test/cases/functions.multiple-calls.css +13 -0
- data/vendor/test/cases/functions.multiple-calls.styl +26 -0
- data/vendor/test/cases/functions.nested-calls.css +3 -0
- data/vendor/test/cases/functions.nested-calls.styl +9 -0
- data/vendor/test/cases/functions.nested.css +10 -0
- data/vendor/test/cases/functions.nested.styl +37 -0
- data/vendor/test/cases/functions.property.css +10 -0
- data/vendor/test/cases/functions.property.styl +11 -0
- data/vendor/test/cases/functions.return.css +15 -0
- data/vendor/test/cases/functions.return.each.css +10 -0
- data/vendor/test/cases/functions.return.each.styl +23 -0
- data/vendor/test/cases/functions.return.styl +86 -0
- data/vendor/test/cases/functions.styl +34 -0
- data/vendor/test/cases/functions.variable.css +9 -0
- data/vendor/test/cases/functions.variable.ident.css +3 -0
- data/vendor/test/cases/functions.variable.ident.styl +11 -0
- data/vendor/test/cases/functions.variable.styl +27 -0
- data/vendor/test/cases/hack.star.css +27 -0
- data/vendor/test/cases/hack.star.styl +37 -0
- data/vendor/test/cases/if.css +43 -0
- data/vendor/test/cases/if.else.css +6 -0
- data/vendor/test/cases/if.else.styl +16 -0
- data/vendor/test/cases/if.mixin.css +7 -0
- data/vendor/test/cases/if.mixin.styl +24 -0
- data/vendor/test/cases/if.postfix.css +61 -0
- data/vendor/test/cases/if.postfix.styl +110 -0
- data/vendor/test/cases/if.selectors.css +16 -0
- data/vendor/test/cases/if.selectors.styl +22 -0
- data/vendor/test/cases/if.styl +99 -0
- data/vendor/test/cases/import.basic/a.styl +5 -0
- data/vendor/test/cases/import.basic/b.styl +5 -0
- data/vendor/test/cases/import.basic/c.styl +3 -0
- data/vendor/test/cases/import.basic.css +11 -0
- data/vendor/test/cases/import.basic.styl +4 -0
- data/vendor/test/cases/import.complex/a.styl +4 -0
- data/vendor/test/cases/import.complex/c.styl +2 -0
- data/vendor/test/cases/import.complex/nested/b.styl +4 -0
- data/vendor/test/cases/import.complex.css +9 -0
- data/vendor/test/cases/import.complex.styl +1 -0
- data/vendor/test/cases/import.index/vendor/a.styl +2 -0
- data/vendor/test/cases/import.index/vendor/b.styl +2 -0
- data/vendor/test/cases/import.index/vendor/c.styl +2 -0
- data/vendor/test/cases/import.index/vendor/index.styl +4 -0
- data/vendor/test/cases/import.index.css +9 -0
- data/vendor/test/cases/import.index.styl +2 -0
- data/vendor/test/cases/import.literal.css +2 -0
- data/vendor/test/cases/import.literal.styl +3 -0
- data/vendor/test/cases/import.mixins.css +7 -0
- data/vendor/test/cases/import.mixins.styl +9 -0
- data/vendor/test/cases/import.ordering/five.styl +2 -0
- data/vendor/test/cases/import.ordering/four.styl +4 -0
- data/vendor/test/cases/import.ordering/two.styl +2 -0
- data/vendor/test/cases/import.ordering.css +15 -0
- data/vendor/test/cases/import.ordering.styl +12 -0
- data/vendor/test/cases/important.css +6 -0
- data/vendor/test/cases/important.styl +6 -0
- data/vendor/test/cases/interpolation.properties.css +40 -0
- data/vendor/test/cases/interpolation.properties.styl +56 -0
- data/vendor/test/cases/introspection.css +7 -0
- data/vendor/test/cases/introspection.styl +14 -0
- data/vendor/test/cases/jquery.css +3 -0
- data/vendor/test/cases/jquery.styl +5 -0
- data/vendor/test/cases/keyframes.css +9 -0
- data/vendor/test/cases/keyframes.fabrication.css +18 -0
- data/vendor/test/cases/keyframes.fabrication.defaults.css +45 -0
- data/vendor/test/cases/keyframes.fabrication.defaults.styl +9 -0
- data/vendor/test/cases/keyframes.fabrication.styl +11 -0
- data/vendor/test/cases/keyframes.styl +6 -0
- data/vendor/test/cases/kwargs.css +63 -0
- data/vendor/test/cases/kwargs.styl +74 -0
- data/vendor/test/cases/list.css +3 -0
- data/vendor/test/cases/list.styl +3 -0
- data/vendor/test/cases/literal.color.css +6 -0
- data/vendor/test/cases/literal.color.styl +5 -0
- data/vendor/test/cases/literal.css +10 -0
- data/vendor/test/cases/literal.styl +18 -0
- data/vendor/test/cases/media.css +14 -0
- data/vendor/test/cases/media.styl +11 -0
- data/vendor/test/cases/mixin.conditional.css +19 -0
- data/vendor/test/cases/mixin.conditional.styl +36 -0
- data/vendor/test/cases/mixin.order.conditional.css +11 -0
- data/vendor/test/cases/mixin.order.conditional.styl +20 -0
- data/vendor/test/cases/mixin.order.css +9 -0
- data/vendor/test/cases/mixin.order.nested.css +9 -0
- data/vendor/test/cases/mixin.order.nested.styl +21 -0
- data/vendor/test/cases/mixin.order.styl +20 -0
- data/vendor/test/cases/mixins/box.styl +11 -0
- data/vendor/test/cases/mixins.complex.css +30 -0
- data/vendor/test/cases/mixins.complex.fix-to.css +15 -0
- data/vendor/test/cases/mixins.complex.fix-to.styl +28 -0
- data/vendor/test/cases/mixins.complex.styl +41 -0
- data/vendor/test/cases/mixins.conditional.css +3 -0
- data/vendor/test/cases/mixins.conditional.styl +8 -0
- data/vendor/test/cases/mixins.nested.css +7 -0
- data/vendor/test/cases/mixins.nested.selectors.css +21 -0
- data/vendor/test/cases/mixins.nested.selectors.styl +31 -0
- data/vendor/test/cases/mixins.nested.styl +14 -0
- data/vendor/test/cases/mixins.order.2.css +11 -0
- data/vendor/test/cases/mixins.order.2.styl +16 -0
- data/vendor/test/cases/mixins.reset.css +75 -0
- data/vendor/test/cases/mixins.reset.styl +27 -0
- data/vendor/test/cases/mixins.return.css +4 -0
- data/vendor/test/cases/mixins.return.styl +8 -0
- data/vendor/test/cases/mixins.root.css +3 -0
- data/vendor/test/cases/mixins.root.styl +5 -0
- data/vendor/test/cases/operator.range.css +15 -0
- data/vendor/test/cases/operator.range.styl +23 -0
- data/vendor/test/cases/operators.assignment.function.css +15 -0
- data/vendor/test/cases/operators.assignment.function.styl +34 -0
- data/vendor/test/cases/operators.assignment.mixin.css +15 -0
- data/vendor/test/cases/operators.assignment.mixin.styl +39 -0
- data/vendor/test/cases/operators.assignment.root.css +25 -0
- data/vendor/test/cases/operators.assignment.root.styl +55 -0
- data/vendor/test/cases/operators.complex.css +9 -0
- data/vendor/test/cases/operators.complex.styl +32 -0
- data/vendor/test/cases/operators.css +40 -0
- data/vendor/test/cases/operators.equality.css +55 -0
- data/vendor/test/cases/operators.equality.styl +55 -0
- data/vendor/test/cases/operators.in.css +37 -0
- data/vendor/test/cases/operators.in.styl +51 -0
- data/vendor/test/cases/operators.mixins.css +10 -0
- data/vendor/test/cases/operators.mixins.styl +25 -0
- data/vendor/test/cases/operators.precedence.css +51 -0
- data/vendor/test/cases/operators.precedence.styl +82 -0
- data/vendor/test/cases/operators.styl +96 -0
- data/vendor/test/cases/operators.subscript.assign.css +21 -0
- data/vendor/test/cases/operators.subscript.assign.styl +45 -0
- data/vendor/test/cases/operators.subscript.css +59 -0
- data/vendor/test/cases/operators.subscript.range.css +14 -0
- data/vendor/test/cases/operators.subscript.range.styl +15 -0
- data/vendor/test/cases/operators.subscript.styl +81 -0
- data/vendor/test/cases/page.css +13 -0
- data/vendor/test/cases/page.styl +13 -0
- data/vendor/test/cases/parent.css +32 -0
- data/vendor/test/cases/parent.styl +33 -0
- data/vendor/test/cases/properties.colons.css +8 -0
- data/vendor/test/cases/properties.colons.styl +10 -0
- data/vendor/test/cases/properties.css +4 -0
- data/vendor/test/cases/properties.one-line.css +10 -0
- data/vendor/test/cases/properties.one-line.styl +11 -0
- data/vendor/test/cases/properties.styl +4 -0
- data/vendor/test/cases/property-access.css +48 -0
- data/vendor/test/cases/property-access.styl +62 -0
- data/vendor/test/cases/regression.107.lookup-failure.css +12 -0
- data/vendor/test/cases/regression.107.lookup-failure.styl +13 -0
- data/vendor/test/cases/regression.127.css +3 -0
- data/vendor/test/cases/regression.127.styl +2 -0
- data/vendor/test/cases/regression.130.css +16 -0
- data/vendor/test/cases/regression.130.styl +6 -0
- data/vendor/test/cases/regression.131.css +7 -0
- data/vendor/test/cases/regression.131.styl +2 -0
- data/vendor/test/cases/regression.137.css +7 -0
- data/vendor/test/cases/regression.137.styl +7 -0
- data/vendor/test/cases/regression.139.css +5 -0
- data/vendor/test/cases/regression.139.styl +21 -0
- data/vendor/test/cases/regression.142.css +39 -0
- data/vendor/test/cases/regression.142.styl +54 -0
- data/vendor/test/cases/regression.146.css +30 -0
- data/vendor/test/cases/regression.146.styl +31 -0
- data/vendor/test/cases/regression.153.css +8 -0
- data/vendor/test/cases/regression.153.styl +9 -0
- data/vendor/test/cases/regression.154.css +8 -0
- data/vendor/test/cases/regression.154.styl +14 -0
- data/vendor/test/cases/regression.156.css +4 -0
- data/vendor/test/cases/regression.156.styl +6 -0
- data/vendor/test/cases/regression.212.css +15 -0
- data/vendor/test/cases/regression.212.styl +14 -0
- data/vendor/test/cases/regression.216.css +10 -0
- data/vendor/test/cases/regression.216.styl +8 -0
- data/vendor/test/cases/regression.220.css +5 -0
- data/vendor/test/cases/regression.220.styl +5 -0
- data/vendor/test/cases/regression.229.css +12 -0
- data/vendor/test/cases/regression.229.styl +9 -0
- data/vendor/test/cases/regression.233.css +6 -0
- data/vendor/test/cases/regression.233.styl +7 -0
- data/vendor/test/cases/regression.235.css +11 -0
- data/vendor/test/cases/regression.235.styl +13 -0
- data/vendor/test/cases/regression.243.css +3 -0
- data/vendor/test/cases/regression.243.styl +4 -0
- data/vendor/test/cases/regression.244.css +3 -0
- data/vendor/test/cases/regression.244.styl +3 -0
- data/vendor/test/cases/regression.247.css +6 -0
- data/vendor/test/cases/regression.247.styl +6 -0
- data/vendor/test/cases/regression.248.compressed.css +4 -0
- data/vendor/test/cases/regression.248.compressed.styl +10 -0
- data/vendor/test/cases/regression.252.css +13 -0
- data/vendor/test/cases/regression.252.styl +13 -0
- data/vendor/test/cases/regression.260.css +6 -0
- data/vendor/test/cases/regression.260.styl +6 -0
- data/vendor/test/cases/regression.267.css +3 -0
- data/vendor/test/cases/regression.267.styl +3 -0
- data/vendor/test/cases/regression.270.css +5 -0
- data/vendor/test/cases/regression.270.styl +7 -0
- data/vendor/test/cases/regression.272.css +11 -0
- data/vendor/test/cases/regression.272.styl +17 -0
- data/vendor/test/cases/regression.274.css +14 -0
- data/vendor/test/cases/regression.274.styl +16 -0
- data/vendor/test/cases/regression.360.css +19 -0
- data/vendor/test/cases/regression.360.styl +1 -0
- data/vendor/test/cases/regression.368.css +4 -0
- data/vendor/test/cases/regression.368.styl +3 -0
- data/vendor/test/cases/regression.379.css +6 -0
- data/vendor/test/cases/regression.379.styl +10 -0
- data/vendor/test/cases/regression.380.css +8 -0
- data/vendor/test/cases/regression.380.styl +14 -0
- data/vendor/test/cases/regression.388.css +2 -0
- data/vendor/test/cases/regression.388.styl +6 -0
- data/vendor/test/cases/regression.415.css +5 -0
- data/vendor/test/cases/regression.415.styl +3 -0
- data/vendor/test/cases/regression.420.css +21 -0
- data/vendor/test/cases/regression.420.styl +29 -0
- data/vendor/test/cases/reset.css +70 -0
- data/vendor/test/cases/reset.styl +16 -0
- data/vendor/test/cases/rule.charset.css +1 -0
- data/vendor/test/cases/rule.charset.styl +2 -0
- data/vendor/test/cases/rulset.css +4 -0
- data/vendor/test/cases/rulset.newline.css +5 -0
- data/vendor/test/cases/rulset.newline.styl +5 -0
- data/vendor/test/cases/rulset.styl +3 -0
- data/vendor/test/cases/scope.complex.css +10 -0
- data/vendor/test/cases/scope.complex.styl +16 -0
- data/vendor/test/cases/scope.css +5 -0
- data/vendor/test/cases/scope.nested.css +9 -0
- data/vendor/test/cases/scope.nested.styl +10 -0
- data/vendor/test/cases/scope.styl +12 -0
- data/vendor/test/cases/selector.interpolation.css +57 -0
- data/vendor/test/cases/selector.interpolation.styl +45 -0
- data/vendor/test/cases/selectors.complex.css +28 -0
- data/vendor/test/cases/selectors.complex.styl +27 -0
- data/vendor/test/cases/selectors.css +50 -0
- data/vendor/test/cases/selectors.nested.comma.css +9 -0
- data/vendor/test/cases/selectors.nested.comma.styl +8 -0
- data/vendor/test/cases/selectors.nested.css +34 -0
- data/vendor/test/cases/selectors.nested.styl +33 -0
- data/vendor/test/cases/selectors.pseudo.css +27 -0
- data/vendor/test/cases/selectors.pseudo.elements.css +26 -0
- data/vendor/test/cases/selectors.pseudo.elements.styl +29 -0
- data/vendor/test/cases/selectors.pseudo.styl +24 -0
- data/vendor/test/cases/selectors.styl +46 -0
- data/vendor/test/cases/self-assignment.css +3 -0
- data/vendor/test/cases/self-assignment.styl +4 -0
- data/vendor/test/cases/vargs.call.css +24 -0
- data/vendor/test/cases/vargs.call.styl +40 -0
- data/vendor/test/cases/vargs.css +30 -0
- data/vendor/test/cases/vargs.styl +49 -0
- data/vendor/test/cases/variable.css +3 -0
- data/vendor/test/cases/variable.styl +4 -0
- data/vendor/test/cases/variables.css +12 -0
- data/vendor/test/cases/variables.styl +17 -0
- data/vendor/test/images/gif +0 -0
- data/vendor/test/images/squirrel.jpeg +0 -0
- data/vendor/test/images/tux.png +0 -0
- data/vendor/test/run.js +151 -0
- data/vendor/testing/index.html +56 -0
- data/vendor/testing/stylus.js +146 -0
- data/vendor/testing/test-js.js +23 -0
- data/vendor/testing/test.css +8 -0
- data/vendor/testing/test.js +23 -0
- data/vendor/testing/test.styl +75 -0
- data/vendor/testing/utils.styl +6 -0
- data/vendor/testing/vendor.styl +3 -0
- metadata +565 -112
- data/.DS_Store +0 -0
- data/lib/.DS_Store +0 -0
- data/lib/node_modules/cssom/.idea/CSSOM.iml +0 -9
- data/lib/node_modules/cssom/.idea/dictionaries/nv.xml +0 -3
- data/lib/node_modules/cssom/.idea/encodings.xml +0 -5
- data/lib/node_modules/cssom/.idea/misc.xml +0 -17
- data/lib/node_modules/cssom/.idea/modules.xml +0 -9
- data/lib/node_modules/cssom/.idea/projectCodeStyle.xml +0 -82
- data/lib/node_modules/cssom/.idea/vcs.xml +0 -8
- data/lib/node_modules/cssom/.idea/workspace.xml +0 -467
- data/lib/node_modules/cssom/.livereload +0 -19
- data/lib/node_modules/cssom/docs/.livereload +0 -19
@@ -0,0 +1,107 @@
|
|
1
|
+
|
2
|
+
## Conditionals
|
3
|
+
|
4
|
+
Conditionals provide control flow to a language which is otherwise static, providing conditional imports, mixins, functions, and more. The examples below are simply examples, and not recommended :)
|
5
|
+
|
6
|
+
### if / else if / else
|
7
|
+
|
8
|
+
The `if` conditional works as you would expect, simply accepting an expression, evaluating the following block when `true`. Along with `if` are the typical `else if` and `else` tokens, acting as fallbacks.
|
9
|
+
|
10
|
+
The example below would conditionally overload the `padding` property, swapping it for margin.
|
11
|
+
|
12
|
+
overload-padding = true
|
13
|
+
|
14
|
+
if overload-padding
|
15
|
+
padding(y, x)
|
16
|
+
margin y x
|
17
|
+
|
18
|
+
body
|
19
|
+
padding 5px 10px
|
20
|
+
|
21
|
+
Another example:
|
22
|
+
|
23
|
+
box(x, y, margin = false)
|
24
|
+
padding y x
|
25
|
+
if margin
|
26
|
+
margin y x
|
27
|
+
|
28
|
+
body
|
29
|
+
box(5px, 10px, true)
|
30
|
+
|
31
|
+
Another `box()` helper:
|
32
|
+
|
33
|
+
box(x, y, margin-only = false)
|
34
|
+
if margin-only
|
35
|
+
margin y x
|
36
|
+
else
|
37
|
+
padding y x
|
38
|
+
|
39
|
+
### unless
|
40
|
+
|
41
|
+
For users familiar with the ruby programming language, we have the `unless` conditional, which is essentially the opposite of `if`, essentially `if (!(expr))`.
|
42
|
+
|
43
|
+
In the example below, if `disable-padding-override` is undefined or `false` padding will be overridden, displaying `margin` instead. However when `true` padding will remain outputting `padding 5px 10px` as expected.
|
44
|
+
|
45
|
+
disable-padding-override = true
|
46
|
+
|
47
|
+
unless disable-padding-override is defined and disable-padding-override
|
48
|
+
padding(x, y)
|
49
|
+
margin y x
|
50
|
+
|
51
|
+
body
|
52
|
+
padding 5px 10px
|
53
|
+
|
54
|
+
### Postfix Conditionals
|
55
|
+
|
56
|
+
Stylus supports postfix conditionals, meaning the `if` and `unless` act as operators, evaluating the left-hand operand, when the right-hand expression is truthy.
|
57
|
+
|
58
|
+
|
59
|
+
For example let's define `negative()`, performing some basic type checking. Below we use block-style conditionals:
|
60
|
+
|
61
|
+
negative(n)
|
62
|
+
unless n is a 'unit'
|
63
|
+
error('invalid number')
|
64
|
+
if n < 0
|
65
|
+
yes
|
66
|
+
else
|
67
|
+
no
|
68
|
+
|
69
|
+
Next we utilize postfix conditionals to keep our function terse.
|
70
|
+
|
71
|
+
negative(n)
|
72
|
+
error('invalid number') unless n is a 'unit'
|
73
|
+
return yes if n < 0
|
74
|
+
no
|
75
|
+
|
76
|
+
Of course we could take this further, and utilize `n < 0 ? yes : no`, or simply stick with booleans, and use only `n < 0`.
|
77
|
+
|
78
|
+
Postfix conditionals may be applied to most single-line statements, for example `@import`, `@charset`, mixins, and of course properties as shown below:
|
79
|
+
|
80
|
+
|
81
|
+
pad(types = margin padding, n = 5px)
|
82
|
+
padding unit(n, px) if padding in types
|
83
|
+
margin unit(n, px) if margin in types
|
84
|
+
|
85
|
+
body
|
86
|
+
pad()
|
87
|
+
|
88
|
+
body
|
89
|
+
pad(margin)
|
90
|
+
|
91
|
+
body
|
92
|
+
apply-mixins = true
|
93
|
+
pad(padding, 10) if apply-mixins
|
94
|
+
|
95
|
+
yielding:
|
96
|
+
|
97
|
+
body {
|
98
|
+
padding: 5px;
|
99
|
+
margin: 5px;
|
100
|
+
}
|
101
|
+
body {
|
102
|
+
margin: 5px;
|
103
|
+
}
|
104
|
+
body {
|
105
|
+
padding: 10px;
|
106
|
+
}
|
107
|
+
|
@@ -0,0 +1,77 @@
|
|
1
|
+
|
2
|
+
## CSS Style
|
3
|
+
|
4
|
+
Stylus transparently supports a regular css-style syntax, meaning you do not need to use an alternative parser, or specify that a certain file is using a specific style.
|
5
|
+
|
6
|
+
### Example
|
7
|
+
|
8
|
+
Below is a small style using the indented approach:
|
9
|
+
|
10
|
+
border-radius()
|
11
|
+
-webkit-border-radius arguments
|
12
|
+
-moz-border-radius arguments
|
13
|
+
border-radius arguments
|
14
|
+
|
15
|
+
body a
|
16
|
+
font 12px/1.4 "Lucida Grande", Arial, sans-serif
|
17
|
+
background black
|
18
|
+
color #ccc
|
19
|
+
|
20
|
+
form input
|
21
|
+
padding 5px
|
22
|
+
border 1px solid
|
23
|
+
border-radius 5px
|
24
|
+
|
25
|
+
Since braces, colons, and semi-colons are optional, we could write this example just as we would with normal css:
|
26
|
+
|
27
|
+
border-radius() {
|
28
|
+
-webkit-border-radius: arguments;
|
29
|
+
-moz-border-radius: arguments;
|
30
|
+
border-radius: arguments;
|
31
|
+
}
|
32
|
+
|
33
|
+
body a {
|
34
|
+
font: 12px/1.4 "Lucida Grande", Arial, sans-serif;
|
35
|
+
background: black;
|
36
|
+
color: #ccc;
|
37
|
+
}
|
38
|
+
|
39
|
+
form input {
|
40
|
+
padding: 5px;
|
41
|
+
border: 1px solid;
|
42
|
+
border-radius: 5px;
|
43
|
+
}
|
44
|
+
|
45
|
+
Since we may mix and match the two variants, the following is valid as well:
|
46
|
+
|
47
|
+
border-radius()
|
48
|
+
-webkit-border-radius: arguments;
|
49
|
+
-moz-border-radius: arguments;
|
50
|
+
border-radius: arguments;
|
51
|
+
|
52
|
+
body a {
|
53
|
+
font: 12px/1.4 "Lucida Grande", Arial, sans-serif;
|
54
|
+
background: black;
|
55
|
+
color: #ccc;
|
56
|
+
}
|
57
|
+
|
58
|
+
form input
|
59
|
+
padding: 5px;
|
60
|
+
border: 1px solid;
|
61
|
+
border-radius: 5px;
|
62
|
+
|
63
|
+
Variables, functions, mixins, and all of the other features that Stylus provides still work as expected:
|
64
|
+
|
65
|
+
main-color = white
|
66
|
+
main-hover-color = black
|
67
|
+
|
68
|
+
body a {
|
69
|
+
color: main-color;
|
70
|
+
&:hover { color: main-hover-color; }
|
71
|
+
}
|
72
|
+
|
73
|
+
body a { color: main-color; &:hover { color: main-hover-color; }}
|
74
|
+
|
75
|
+
There are currently a few exceptions to this rule, since the two styles may be mixed and matched some indentation rules still apply. So although not _every_ plain-css stylesheet will work without modification this feature still allows those who prefer css syntax may still utilize the other powerful features provided by Stylus.
|
76
|
+
|
77
|
+
|
@@ -0,0 +1,50 @@
|
|
1
|
+
|
2
|
+
## Error Reporting
|
3
|
+
|
4
|
+
Stylus has fantastic error reporting built in for syntax, parse, and evaluation errors, complete with stack traces, line numbers, and filenames.
|
5
|
+
|
6
|
+
### Parse Error
|
7
|
+
|
8
|
+
Parse error example:
|
9
|
+
|
10
|
+
body
|
11
|
+
form input
|
12
|
+
== padding 5px
|
13
|
+
|
14
|
+
yielding:
|
15
|
+
|
16
|
+
Error: /Users/tj/Projects/stylus/testing/test.styl:4
|
17
|
+
3: ' form input'
|
18
|
+
4: ' == padding 5px'
|
19
|
+
|
20
|
+
illegal unary ==
|
21
|
+
|
22
|
+
### Evaluation Error
|
23
|
+
|
24
|
+
This "runtime" or evaluation error is caused due to passing a string to `border-radius()` instead of the expected `Unit` by using our helper `ensure(n, 'unit')`.
|
25
|
+
|
26
|
+
ensure(val, type)
|
27
|
+
unless val is a type
|
28
|
+
error('expected a ' + type + ', but got ' + typeof(val))
|
29
|
+
|
30
|
+
border-radius(n)
|
31
|
+
ensure(n, 'unit')
|
32
|
+
-webkit-border-radius n
|
33
|
+
-moz-border-radius n
|
34
|
+
border-radius n
|
35
|
+
|
36
|
+
body
|
37
|
+
border-radius '5px'
|
38
|
+
|
39
|
+
yielding:
|
40
|
+
|
41
|
+
Error: /Users/tj/Projects/stylus/examples/error.styl:12
|
42
|
+
11: ''
|
43
|
+
12: 'body'
|
44
|
+
13: ' border-radius \'5px\''
|
45
|
+
14: ''
|
46
|
+
|
47
|
+
expected a unit, but got string
|
48
|
+
at ensure() (/Users/tj/Projects/stylus/examples/error.styl:2)
|
49
|
+
at border-radius() (/Users/tj/Projects/stylus/examples/error.styl:5)
|
50
|
+
at "body" (/Users/tj/Projects/stylus/examples/error.styl:10)
|
@@ -0,0 +1,27 @@
|
|
1
|
+
|
2
|
+
## Escaping
|
3
|
+
|
4
|
+
Stylus allows you to escape characters, effectively turning them into identifiers, so that they can be rendered as literals. For example:
|
5
|
+
|
6
|
+
body
|
7
|
+
padding 1 \+ 2
|
8
|
+
|
9
|
+
will compile to:
|
10
|
+
|
11
|
+
body {
|
12
|
+
padding: 1 + 2;
|
13
|
+
}
|
14
|
+
|
15
|
+
|
16
|
+
Not that Stylus requires that `/` is parenthesized when used in a property:
|
17
|
+
|
18
|
+
body
|
19
|
+
font 14px/1.4
|
20
|
+
font (14px/1.4)
|
21
|
+
|
22
|
+
yields:
|
23
|
+
|
24
|
+
body {
|
25
|
+
font: 14px/1.4;
|
26
|
+
font: 10px;
|
27
|
+
}
|
@@ -0,0 +1,159 @@
|
|
1
|
+
|
2
|
+
## Stylus Executable
|
3
|
+
|
4
|
+
Stylus ships with the `stylus` executable for converting stylus to css.
|
5
|
+
|
6
|
+
Usage: stylus [options] [command] [< in [> out]]
|
7
|
+
[file|dir ...]
|
8
|
+
|
9
|
+
Commands:
|
10
|
+
|
11
|
+
help <prop> Opens help info for <prop> in
|
12
|
+
your default browser. (osx only)
|
13
|
+
|
14
|
+
Options:
|
15
|
+
|
16
|
+
-u, --use <path> Utilize the stylus plugin at <path>
|
17
|
+
-i, --interactive Start interactive REPL
|
18
|
+
-w, --watch Watch file(s) for changes and re-compile
|
19
|
+
-o, --out <dir> Output to <dir> when passing files
|
20
|
+
-C, --css <src> [dest] Convert css input to stylus
|
21
|
+
-I, --include <path> Add <path> to lookup paths
|
22
|
+
-c, --compress Compress css output
|
23
|
+
-d, --compare Display input along with output
|
24
|
+
-f, --firebug Emits debug infos in the generated css that
|
25
|
+
can be used by the FireStylus Firebug plugin
|
26
|
+
-l, --line-numbers Emits comments in the generated css
|
27
|
+
indicating the corresponding stylus line
|
28
|
+
-V, --version Display the version of stylus
|
29
|
+
-h, --help Display help information
|
30
|
+
|
31
|
+
### STDIO Compilation Example
|
32
|
+
|
33
|
+
`stylus` reads from _stdin_ and outputs to _stdout_, so for example:
|
34
|
+
|
35
|
+
$ stylus --compress < some.styl > some.css
|
36
|
+
|
37
|
+
Try stylus some in the terminal, type below and press CTRL-D for __EOF__:
|
38
|
+
|
39
|
+
$ stylus
|
40
|
+
body
|
41
|
+
color red
|
42
|
+
font 14px Arial, sans-serif
|
43
|
+
|
44
|
+
### Compiling Files Example
|
45
|
+
|
46
|
+
`stylus` also accepts files and directories, for example a directory named `css` will compile and output the `.css` files in the same directory.
|
47
|
+
|
48
|
+
$ stylus css
|
49
|
+
|
50
|
+
The following will output to `./public/stylesheets`:
|
51
|
+
|
52
|
+
$ stylus css --out public/stylesheets
|
53
|
+
|
54
|
+
Or a few files:
|
55
|
+
|
56
|
+
$ stylus one.styl two.styl
|
57
|
+
|
58
|
+
For development purpose, you can enable the `linenos` option to emit comments indicating
|
59
|
+
the Stylus filename and line number in the generated css:
|
60
|
+
|
61
|
+
$ stylus --line-numbers <path>
|
62
|
+
|
63
|
+
Or the `firebug` option if you want to use
|
64
|
+
the [FireStylus extension for Firebug](//github.com/LearnBoost/stylus/blob/master/docs/firebug.md):
|
65
|
+
|
66
|
+
$ stylus --firebug <path>
|
67
|
+
|
68
|
+
### Converting CSS
|
69
|
+
|
70
|
+
If we wish to convert css to the terse Stylus syntax, we can utilize the `--css` flag.
|
71
|
+
|
72
|
+
Via stdio:
|
73
|
+
|
74
|
+
$ stylus --css < test.css > test.styl
|
75
|
+
|
76
|
+
Output a `.styl` file of the same basename:
|
77
|
+
|
78
|
+
$ stylus --css test.css
|
79
|
+
|
80
|
+
Output to a specific destination:
|
81
|
+
|
82
|
+
$ stylus --css test.css /tmp/out.styl
|
83
|
+
|
84
|
+
### CSS Property Help
|
85
|
+
|
86
|
+
On osx `stylus help <prop>` will open your default browser and display help documentation for the given `<prop>`.
|
87
|
+
|
88
|
+
$ stylus help box-shadow
|
89
|
+
|
90
|
+
### Interactive Shell
|
91
|
+
|
92
|
+
The Stylus REPL (Read-Eval-Print-Loop) or "interactive shell" allows you to
|
93
|
+
play around with Stylus expressions directly from your terminal. Note that this works only for expressions, not selectors etc. To use simple add the `-i`, or `--interactive` flag:
|
94
|
+
|
95
|
+
$ stylus -i
|
96
|
+
> color = white
|
97
|
+
=> #fff
|
98
|
+
> color - rgb(200,50,0)
|
99
|
+
=> #37cdff
|
100
|
+
> color
|
101
|
+
=> #fff
|
102
|
+
> color -= rgb(200,50,0)
|
103
|
+
=> #37cdff
|
104
|
+
> color
|
105
|
+
=> #37cdff
|
106
|
+
> rgba(color, 0.5)
|
107
|
+
=> rgba(55,205,255,0.5)
|
108
|
+
|
109
|
+
### Utilizing Plugins
|
110
|
+
|
111
|
+
For our examples we will utilize the [nib](https://github.com/visionmedia/nib) Stylus plugin to illustrate it's CLI usage. Suppose we have the following stylus, importing nib and utilize it's `linear-gradient()` function.
|
112
|
+
|
113
|
+
@import 'nib'
|
114
|
+
|
115
|
+
body
|
116
|
+
background: linear-gradient(20px top, white, black)
|
117
|
+
|
118
|
+
Our first attempt to render using `stylus(1)` via stdio might look like this:
|
119
|
+
|
120
|
+
$ stylus < test.styl
|
121
|
+
|
122
|
+
Which would yield the following error because stylus does not know where to find nib in our machine.
|
123
|
+
|
124
|
+
Error: stdin:3
|
125
|
+
1|
|
126
|
+
2|
|
127
|
+
> 3| @import 'nib'
|
128
|
+
4|
|
129
|
+
5| body
|
130
|
+
6| background: linear-gradient(20px top, white, black)
|
131
|
+
|
132
|
+
For plugins that simply supply stylus APIs we could add the path to the stylus lookup paths by using the `--include` or `-I` flag:
|
133
|
+
|
134
|
+
$ stylus < test.styl --include ../nib/lib
|
135
|
+
|
136
|
+
Now yielding the following output. As you might notice the calls to `gradient-data-uri()` and `create-gradient-image()` output as literals, this is because exposing the library path is not enough when the plugin provides a JavaScript API, though if we wished to only utilize the pure-stylus nib functions we would be fine.
|
137
|
+
|
138
|
+
body {
|
139
|
+
background: url(gradient-data-uri(create-gradient-image(20px, top)));
|
140
|
+
background: -webkit-gradient(linear, left top, left bottom, color-stop(0, #fff), color-stop(1, #000));
|
141
|
+
background: -webkit-linear-gradient(top, #fff 0%, #000 100%);
|
142
|
+
background: -moz-linear-gradient(top, #fff 0%, #000 100%);
|
143
|
+
background: linear-gradient(top, #fff 0%, #000 100%);
|
144
|
+
}
|
145
|
+
|
146
|
+
So, what we need to do is utilize the `--use`, or `-u` flag which expects a path to a node module, with or without the ".js" extension. This `require()`s the module, expecting a function to be exported as `module.exports`, which then calls `style.use(fn())` to allow the plugin to expose itself, defining js functions etc.
|
147
|
+
|
148
|
+
$ stylus < test.styl --use ../nib/lib/nib
|
149
|
+
|
150
|
+
Yielding the expected result:
|
151
|
+
|
152
|
+
body {
|
153
|
+
background: url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAAUCAYAAABMDlehAAAABmJLR0QA/wD/AP+gvaeTAAAAI0lEQVQImWP4+fPnf6bPnz8zMH358oUBwkIjKJBgYGNj+w8Aphk4blt0EcMAAAAASUVORK5CYII=");
|
154
|
+
background: -webkit-gradient(linear, left top, left bottom, color-stop(0, #fff), color-stop(1, #000));
|
155
|
+
background: -webkit-linear-gradient(top, #fff 0%, #000 100%);
|
156
|
+
background: -moz-linear-gradient(top, #fff 0%, #000 100%);
|
157
|
+
background: linear-gradient(top, #fff 0%, #000 100%);
|
158
|
+
}
|
159
|
+
|
@@ -0,0 +1,60 @@
|
|
1
|
+
|
2
|
+
## FireStylus extension for Firebug
|
3
|
+
|
4
|
+
[FireStylus](//github.com/parallel/firestylus) is a Firebug extension
|
5
|
+
that makes Firebug display the Stylus filename and line numbers of
|
6
|
+
the Stylus-generated CSS styles rather than those of the generated CSS.
|
7
|
+
|
8
|
+
![Screenshot](//raw.github.com/parallel/firestylus/master/src/chrome/skin/screenshot.png)
|
9
|
+
|
10
|
+
### Usage
|
11
|
+
|
12
|
+
First, you need to install [Firebug](https://addons.mozilla.org/firefox/downloads/latest/1843/addon-1843-latest.xpi?src=addondetail)
|
13
|
+
and the [FireStylus extension](//github.com/parallel/firestylus)
|
14
|
+
|
15
|
+
Then, you need to enable the Stylus's `firebug` option when generating your CSS.
|
16
|
+
|
17
|
+
Command line
|
18
|
+
|
19
|
+
$ stylus -f <path>
|
20
|
+
$ stylus --firebug <path>
|
21
|
+
|
22
|
+
Javascript API
|
23
|
+
|
24
|
+
var stylus = require('stylus');
|
25
|
+
|
26
|
+
stylus(str)
|
27
|
+
.set('firebug', true)
|
28
|
+
.render(function(err, css){
|
29
|
+
// logic
|
30
|
+
});
|
31
|
+
|
32
|
+
Connect / Express
|
33
|
+
|
34
|
+
var stylus = require('stylus');
|
35
|
+
|
36
|
+
var server = connect.createServer(
|
37
|
+
stylus.middleware({
|
38
|
+
src: __dirname
|
39
|
+
, dest: __dirname + '/public'
|
40
|
+
, firebug: true
|
41
|
+
})
|
42
|
+
, connect.static(__dirname + '/public')
|
43
|
+
);
|
44
|
+
|
45
|
+
### Compatibility
|
46
|
+
|
47
|
+
FireStylus should work with all versions of Firefox after
|
48
|
+
and including 3.0, and all Firebug versions after and including 1.4
|
49
|
+
|
50
|
+
- Firefox 3+ (also works with version 5)
|
51
|
+
- Firebug 1.4+
|
52
|
+
|
53
|
+
### Limitations
|
54
|
+
|
55
|
+
FireStylus and FireSass are incompatible. You cannot enable them
|
56
|
+
simultaneously.
|
57
|
+
|
58
|
+
FireStylus (like FireSass) only works in the html pane of firebug, the others,
|
59
|
+
such as the css pane won't work due to firebug limitations.
|
60
|
+
|
@@ -0,0 +1,26 @@
|
|
1
|
+
|
2
|
+
## @font-face
|
3
|
+
|
4
|
+
The `@font-face` at-rule expects as you would expect, simply followed by a block of properties:
|
5
|
+
|
6
|
+
|
7
|
+
@font-face
|
8
|
+
font-family Geo
|
9
|
+
font-style normal
|
10
|
+
src url(fonts/geo_sans_light/GensansLight.ttf)
|
11
|
+
|
12
|
+
.ingeo
|
13
|
+
font-family Geo
|
14
|
+
|
15
|
+
yielding:
|
16
|
+
|
17
|
+
|
18
|
+
@font-face {
|
19
|
+
font-family: Geo;
|
20
|
+
font-style: normal;
|
21
|
+
src: url("fonts/geo_sans_light/GensansLight.ttf");
|
22
|
+
}
|
23
|
+
.ingeo {
|
24
|
+
font-family: Geo;
|
25
|
+
}
|
26
|
+
|
@@ -0,0 +1,192 @@
|
|
1
|
+
|
2
|
+
## Functions
|
3
|
+
|
4
|
+
Stylus features powerful in-language function definition. Function definition appears identical to mixins, however functions may return a value.
|
5
|
+
|
6
|
+
### Return Values
|
7
|
+
|
8
|
+
Let's try a trivial example, creating a function that adds two numbers.
|
9
|
+
|
10
|
+
add(a, b)
|
11
|
+
a + b
|
12
|
+
|
13
|
+
We may then utilize this function in conditions, as property values, etc.
|
14
|
+
|
15
|
+
body
|
16
|
+
padding add(10px, 5)
|
17
|
+
|
18
|
+
Rendering
|
19
|
+
|
20
|
+
body {
|
21
|
+
padding: 15px;
|
22
|
+
}
|
23
|
+
|
24
|
+
### Argument Defaults
|
25
|
+
|
26
|
+
Optional arguments may default to a given expression. With Stylus we may even default arguments to leading arguments! For example:
|
27
|
+
|
28
|
+
|
29
|
+
add(a, b = a)
|
30
|
+
a + b
|
31
|
+
|
32
|
+
add(10, 5)
|
33
|
+
// => 15
|
34
|
+
|
35
|
+
add(10)
|
36
|
+
// => 20
|
37
|
+
|
38
|
+
note that since argument defaults are assignments, we can also utilize function calls for defaults:
|
39
|
+
|
40
|
+
add(a, b = unit(a, px))
|
41
|
+
a + b
|
42
|
+
|
43
|
+
### Function Bodies
|
44
|
+
|
45
|
+
We can take our simple `add()` function further, by casting all units passed as `px` via the `unit()` built-in. Re-assigning each argument and providing a unit type string (or identifier), which disregards unit conversion.
|
46
|
+
|
47
|
+
add(a, b = a)
|
48
|
+
a = unit(a, px)
|
49
|
+
b = unit(b, px)
|
50
|
+
a + b
|
51
|
+
|
52
|
+
add(15%, 10deg)
|
53
|
+
// => 25
|
54
|
+
|
55
|
+
### Multiple Return Values
|
56
|
+
|
57
|
+
Stylus functions can return several values, just as you can assign several values to a variable. For example the following is a valid assignment:
|
58
|
+
|
59
|
+
sizes = 15px 10px
|
60
|
+
|
61
|
+
sizes[0]
|
62
|
+
// => 15px
|
63
|
+
|
64
|
+
Similarly we may return several values:
|
65
|
+
|
66
|
+
sizes()
|
67
|
+
15px 10px
|
68
|
+
|
69
|
+
sizes()[0]
|
70
|
+
// => 15px
|
71
|
+
|
72
|
+
One slight exception is when return values are identifiers, for example the following looks like a property assignment to Stylus since no operators are present.
|
73
|
+
|
74
|
+
swap(a, b)
|
75
|
+
b a
|
76
|
+
|
77
|
+
To disambiguate we may either wrap in parens, or utilize the `return` keyword.
|
78
|
+
|
79
|
+
swap(a, b)
|
80
|
+
(b a)
|
81
|
+
|
82
|
+
swap(a, b)
|
83
|
+
return b a
|
84
|
+
|
85
|
+
### Conditionals
|
86
|
+
|
87
|
+
Let's say we want to create a function named `stringish()` to see if the value given can be transformed to a string. We check if `val` is a string, or an ident which is string-like. Because undefined identifiers yield themselves as the value, we may compare them to them-selves as shown below, where `yes` and `no` are used in place of `true` and `false`.
|
88
|
+
|
89
|
+
|
90
|
+
stringish(val)
|
91
|
+
if val is a 'string' or val is a 'ident'
|
92
|
+
yes
|
93
|
+
else
|
94
|
+
no
|
95
|
+
|
96
|
+
usage:
|
97
|
+
|
98
|
+
stringish('yay') == yes
|
99
|
+
// => true
|
100
|
+
|
101
|
+
stringish(yay) == yes
|
102
|
+
// => true
|
103
|
+
|
104
|
+
stringish(0) == no
|
105
|
+
// => true
|
106
|
+
|
107
|
+
__note__: `yes` and `no` are not boolean literals, they are simply undefined identifiers in this case.
|
108
|
+
|
109
|
+
Another example:
|
110
|
+
|
111
|
+
|
112
|
+
compare(a, b)
|
113
|
+
if a > b
|
114
|
+
higher
|
115
|
+
else if a < b
|
116
|
+
lower
|
117
|
+
else
|
118
|
+
equal
|
119
|
+
|
120
|
+
usage:
|
121
|
+
|
122
|
+
compare(5, 2)
|
123
|
+
// => higher
|
124
|
+
|
125
|
+
compare(1, 5)
|
126
|
+
// => lower
|
127
|
+
|
128
|
+
compare(10, 10)
|
129
|
+
// => equal
|
130
|
+
|
131
|
+
### Aliasing
|
132
|
+
|
133
|
+
To alias a function we can simply assign a function's name to a new identifier. For example our previous `add()` function could be exposed as `plus()` as well, simply by:
|
134
|
+
|
135
|
+
plus = add
|
136
|
+
|
137
|
+
plus(1, 2)
|
138
|
+
// => 3
|
139
|
+
|
140
|
+
### Variable Functions
|
141
|
+
|
142
|
+
In the same way that we can "alias" a function, we can pass a function as well, here our `invoke()` function accepts a function, so we can pass it `add()` or `sub()`.
|
143
|
+
|
144
|
+
invoke(a, b, fn)
|
145
|
+
fn(a, b)
|
146
|
+
|
147
|
+
add(a, b)
|
148
|
+
a + b
|
149
|
+
|
150
|
+
body
|
151
|
+
padding invoke(5, 10, add)
|
152
|
+
padding invoke(5, 10, sub)
|
153
|
+
|
154
|
+
yielding:
|
155
|
+
|
156
|
+
body {
|
157
|
+
padding: 15;
|
158
|
+
padding: -5;
|
159
|
+
}
|
160
|
+
|
161
|
+
### arguments
|
162
|
+
|
163
|
+
The `arguments` local is available to all function bodies, and contains all the arguments passed. For example:
|
164
|
+
|
165
|
+
sum()
|
166
|
+
n = 0
|
167
|
+
for num in arguments
|
168
|
+
n = n + num
|
169
|
+
|
170
|
+
sum(1,2,3,4,5)
|
171
|
+
// => 15
|
172
|
+
|
173
|
+
### Hash Example
|
174
|
+
|
175
|
+
Below we define the `get(hash, key)` function, which will return the
|
176
|
+
value of `key`, or `null`. We iterate each `pair` in `hash`, returning the pair's second node when the first (the `key`) matches.
|
177
|
+
|
178
|
+
get(hash, key)
|
179
|
+
return pair[1] if pair[0] == key for pair in hash
|
180
|
+
|
181
|
+
As you can see below, in-language functions paired with robust stylus expressions can provide great flexibility.
|
182
|
+
|
183
|
+
hash = (one 1) (two 2) (three 3)
|
184
|
+
|
185
|
+
get(hash, two)
|
186
|
+
// => 2
|
187
|
+
|
188
|
+
get(hash, three)
|
189
|
+
// => 3
|
190
|
+
|
191
|
+
get(hash, something)
|
192
|
+
// => null
|