Skip to content

Instantly share code, notes, and snippets.

@michealbenedict
Created May 22, 2011 21:28
Show Gist options
  • Select an option

  • Save michealbenedict/985913 to your computer and use it in GitHub Desktop.

Select an option

Save michealbenedict/985913 to your computer and use it in GitHub Desktop.
Stylus + Express.js
var express = require('express');
var stylus = require('stylus');
var app = express.createServer();
// Configuration
app.use(stylus.middleware({
debug: true,
src: __dirname + '/public',
dest: __dirname + '/public',
compile: compileMethod
}));
app.configure(function(){
app.set('views', __dirname + '/views');
app.set('view engine', 'jade');
app.use(express.bodyParser());
app.use(express.methodOverride());
app.use(app.router);
app.use(express.static(__dirname + '/public'));
});
function compileMethod(str) {
return stylus(str)
.set('compress', true);
};
// Routes
app.get('/', function(req, res){
res.render('index', {
title: 'confab.im'
});
});
// Running
app.listen(8000)
console.log('Listening on port 8000');
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment