Skip to content

Instantly share code, notes, and snippets.

@alfrednerstu
Created June 13, 2011 15:38
Show Gist options
  • Save alfrednerstu/1023006 to your computer and use it in GitHub Desktop.
Save alfrednerstu/1023006 to your computer and use it in GitHub Desktop.
Stylus setup
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'
@tj
Copy link

tj commented Jun 14, 2011

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment