Skip to content

Instantly share code, notes, and snippets.

@marlun
Created August 30, 2011 18:38
Show Gist options
  • Save marlun/1181652 to your computer and use it in GitHub Desktop.
Save marlun/1181652 to your computer and use it in GitHub Desktop.
stylus = require 'stylus'
path = require 'path'
express = require 'express'
app = express.createServer()
public_dir = path.join __dirname, 'public'
styles_dir = path.join public_dir, 'styles'
# Setup stylus compiler
compile = (str, path) ->
stylus(str).set('filename', path).set('compress', true)
app.set 'views', __dirname + '/views'
app.set 'view engine', 'ejs'
app.set 'view options', layout: false
app.use express.logger()
app.use express.bodyParser()
app.use app.router
app.use stylus.middleware src: styles_dir, dest: styles_dir, compile: compile
app.use express.compiler src: public_dir, dest: public_dir, enable: ['coffeescript']
app.use express.static public_dir
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment