Skip to content

Instantly share code, notes, and snippets.

@monokrome
Created September 22, 2011 05:41
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save monokrome/1234138 to your computer and use it in GitHub Desktop.
Save monokrome/1234138 to your computer and use it in GitHub Desktop.
express = require 'express'
stylus = require 'stylus'
path = require 'path'
public_dir = (filename) -> path.join __dirname, '../public', filename or ''
get_stylus_options = (server) ->
stylus_options =
compress: server.env == 'production'
debug: server.env != 'production'
force: server.env != 'production'
linenos: server.env != 'production'
firebug: server.env != 'production'
src: path.join __dirname, 'styles'
dest: public_dir 'styles'
exports.apply = (server) ->
server.use express.static public_dir()
server.use stylus.middleware get_stylus_options server
server.set 'views', public_dir 'views'
server.configure 'production', ->
this.set 'listening-port', process.env.NODE_PORT || 80
server.configure 'development', ->
this.set 'listening-port', process.env.NODE_PORT || 8000
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment