Using nib directly #112

gitbase opened this Issue Jul 30, 2012 · 8 comments

3 participants


Just trying to figure out something.

I would like to pass stylus code with the @import nib to some function from the nib module, and then get the
CSS code in return.

Possible ?

tj commented Jul 30, 2012

im not sure what you mean


I am building a small piece of script that I can use as an API for a particular service.

Basically, I would like to pass a piece of stylus code with nib to it (HTTP POST), for example:

@import 'nib'

body {
  background: linear-gradient(top, white, black);

Then in return I would like to get the CSS code rendered/generated.

The user will then be able to use the CSS code for some purpose.

Hope I made sense this time ?

So how would I go about doing this ? I could'nt find any option to use nib in the stylus's bin nor any method in the nib/stylus npm modules.

tj commented Jul 31, 2012

ah I see, I'm doing similar actually :)


well, so ... how would I go about doing it ? or is it not possible atm ?

If it's possible then let me know, so that I can integrate it.

It's just going to be an extra nice feature in my app.


random msg for a notification as we had talked about - --nib flag with @import 'nib' prepended to code ?

tj commented Aug 21, 2012

actually this might have to wait. ATM I can't think of any reasonable way to do this because npm install -g nib and require('nib') will still fail, so we can't (easily) access the path to nib


ok, np!


we also need the instructions how to use the stylus binary in the readme. what works for me is specified on the bottom of the stylus executable doc page:

_npm_prefix=$(npm prefix -g)
stylus $filepath.styl --use $_npm_prefix/lib/node_modules/nib/lib/nib
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment