Skip to content

Instantly share code, notes, and snippets.

@vio
Created November 22, 2016 13:56
Show Gist options
  • Save vio/2438700ad7da091c553c6faa72bf51a5 to your computer and use it in GitHub Desktop.
Save vio/2438700ad7da091c553c6faa72bf51a5 to your computer and use it in GitHub Desktop.

Stylus

Projects

Frameworks:

Typography

Media queries

Grids

Animations

Diff

Ideas

Things to check

New features

  • hoisting
  • globals
  • anonymous functions
  • convert builtin

Bugs

  • when in json, a string that starts with '\f' will be converted to literal
  • when using return inside a conditional, it's causing just to return from if conditional - return if
  • sourcemap - reporting wrong file path for block mixins
  • is failing to compile 2nd else with comment before
  • current-media() inside a block mixin with a dynamic @media is not working
  • current-media() inside a block is not working

Internals

I don't see how it can help with gonzales (with your patch you will get AST after evaluating, and you can't get actual source code of a Stylus file after processing it). You already can get an AST after parsing (much better for using with gonzales and almost all other tools):

var fs = require('fs')
  , stylus = require('stylus')
  , styl = fs.readFileSync('test.styl', 'utf-8');

var ast = new stylus.Parser(styl).parse();

You can use stylus.deps method (not yet documented) to get the dependencies (used imports): https://github.com/LearnBoost/stylus/blob/master/lib/renderer.js#L128 - deps()

var deps = stylus(fs.readFileSync(file, 'utf-8')).deps(file);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment