stylus / nib

Stylus mixins, utilities, components, and gradient image generation
http://stylus.github.io/nib
MIT License
1.91k stars 249 forks source link

Using nib directly #112

Open gitbase opened 11 years ago

gitbase commented 11 years ago

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 11 years ago

im not sure what you mean

gitbase commented 11 years ago

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 11 years ago

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

gitbase commented 11 years ago

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.

gitbase commented 11 years ago

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

tj commented 11 years ago

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

gitbase commented 11 years ago

ok, np!

flying-sheep commented 11 years ago

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