1

How do you use Jeet in Express?

This is part of my app.js file:

app.set('views', __dirname + '/views')
app.set('view engine', 'jade')
app.use(stylus.middleware(
  { src: __dirname + '/public'
  , compile: compile
  }
))
app.use(express.static(__dirname + '/public'))

Following the Stylus plugin documentation I should do this:

app.configure(function () {
  app.use(stylus.middleware({
    src: __dirname + '/views',
    dest: __dirname + '/public',
    compile: function (str, path, fn) {
      stylus(str)
        .set('filename', path)
        .use(example())
        .render(fn);
    }
  }));
});

But I'm not able to get things working.

Thanks for all help.

Ella S.
  • 41
  • 6

1 Answers1

3

Found the solution. Add next function in app.js and all works fine.

function compile(str, path) {
  return stylus(str)
    .set('filename', path)
    .use(jeet())
}

And at the top of app.js:

var jeet = require('jeet');
Ella S.
  • 41
  • 6