Setting up auto compile for Stylus

ryanzec picture ryanzec · Jun 12, 2012 · Viewed 17.8k times · Source

I have installed node.js/stylus/nib on my mac and I can manually compile .styl file to .css on the command line. I also know there is this stylus.middleware() things that keeps coming up when I search for how to setup auto-compiling when the .styl changes, however I have no idea how I am supposed to implement it (I have never used node.js before).

What file do I put that code in?

How do I start this code so it is always run?

I think I am missing a few things on the node side to be able to set this up.

Answer

k3liutZu picture k3liutZu · Nov 9, 2012

From the command line you can use:

stylus -w folder/

or just for another example:

stylus -w styl/*.styl -o css/

It will watch for changes and compile all *.styl files that live under that folder.