Created
June 11, 2012 15:48
-
-
Save sdb/2910774 to your computer and use it in GitHub Desktop.
brunch + chaplin + express
This file contains 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
server = require("./server") | |
server.startServer 3333, "public" |
This file contains 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
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 |
This file contains 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
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