jstransformers / jstransformer-stylus

Stylus support for JSTransformers.
http://npmjs.com/jstransformer-stylus
MIT License
6 stars 1 forks source link

Use `use` #15

Closed calebeby closed 8 years ago

calebeby commented 8 years ago

Hi, I need to use jeet on my project, but it is not documented how to use stylus's use (with jstransformer-stylus).

andy-hanson commented 8 years ago

Do you have the jstransformer-stylus package installed? This is the repository for that tool, not for stylus itself.

calebeby commented 8 years ago

Yes, I do. I am wondering how to use Stylus's use functionality with JSTransformers

calebeby commented 8 years ago

@ForbesLindesay @RobLoach @andy-hanson Is this implemented? How do I use this?

calebeby commented 8 years ago

I figured out how to use one module:

use: jeet()

after

jeet = require('jeet')

but how do I use more than one? I tried passing an array to use, but then it errors with:

TypeError: fn.call is not a function
  at Renderer.use

I'm thinking that c7079a8 has something to do with it?

calebeby commented 8 years ago

@RobLoach I figured it out. Can you change

  // special options with single parameter through their function names
  for (var k in specialSingle) {
    renderer[k](specialSingle[k]);
  }

to

  // special options with single parameter through their function names
  for (var k in specialSingle) {
    var options = []
    if (typeof(specialSingle[k]) === 'object') {
      options = specialSingle[k];
    } else {
      options = [specialSingle[k]];
    }
    for (var i in options) {
      var option = options[i]
      renderer[k](option);
    }
  }

here

Thanks.

RobLoach commented 8 years ago

Looks like a great improvement. Mind sending in a Pull Request? Then you'll get git author credit as a contributor :wink:

calebeby commented 8 years ago

Yeah, sure. I'll try to make a pull request this afternoon

calebeby commented 8 years ago

Or now. #16

RobLoach commented 8 years ago

Great work!