Skip to content

Instantly share code, notes, and snippets.

@sdb
Created June 11, 2012 15:48
Show Gist options
  • Save sdb/2910774 to your computer and use it in GitHub Desktop.
Save sdb/2910774 to your computer and use it in GitHub Desktop.
brunch + chaplin + express
server = require("./server")
server.startServer 3333, "public"
exports.config =
# See http://brunch.readthedocs.org/en/latest/config.html for documentation.
files:
javascripts:
defaultExtension: 'coffee'
joinTo:
'javascripts/app.js': /^app/
'javascripts/vendor.js': /^vendor/
order:
before: [
'vendor/scripts/console-helper.js',
'vendor/scripts/jquery-1.7.2.js',
'vendor/scripts/underscore-1.3.3.js',
'vendor/scripts/backbone-0.9.2.js'
]
stylesheets:
defaultExtension: 'styl'
joinTo: 'stylesheets/app.css'
order:
before: ['vendor/styles/normalize.css']
after: ['vendor/styles/helpers.css']
templates:
defaultExtension: 'hbs'
joinTo: 'javascripts/app.js'
framework: 'chaplin'
server:
path: 'server.coffee'
port: 3333
express = require("express")
exports.startServer = (port, path, callback = (->)) ->
server = express.createServer()
server.configure ->
server.use express.static path
server.set 'views', path
server.set 'view options', layout: no
server.register '.html', compile: (str, options) ->
(locals) -> str
server.get '/', (req, res) ->
res.render 'index.html'
server.listen parseInt port, 10
server.on 'listening', callback
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment