Created
June 13, 2011 15:38
-
-
Save alfrednerstu/1023006 to your computer and use it in GitHub Desktop.
Stylus setup
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
connect = require 'connect' | |
express = require 'express' | |
jade = require 'jade' | |
stylus = require 'stylus' | |
app = express.createServer() | |
# CONFIGURATION | |
app.configure(() -> | |
app.set 'view engine', 'jade' | |
app.set 'views', "#{__dirname}/views" | |
app.use connect.bodyParser() | |
app.use connect.static(__dirname + '/public') | |
app.use express.cookieParser() | |
app.use express.session({secret : "shhhhhhhhhhhhhh!"}) | |
app.use express.logger() | |
app.use express.methodOverride() | |
app.use app.router | |
app.use stylus.middleware({ | |
src: "#{__dirname}/views" | |
dest: "#{__dirname}/public/css" | |
compress: true | |
}) | |
) | |
app.configure 'development', () -> | |
app.use express.errorHandler({ | |
dumpExceptions: true | |
showStack : true | |
}) | |
app.configure 'production', () -> | |
app.use express.errorHandler() | |
# ROUTES | |
app.get '/', (req, res) -> | |
res.render 'index' |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
you'll want to move
static()
below the stylus middleware (or add another if you want, really depends), since stylus itself does not serve the css it generates.