Skip to content

Instantly share code, notes, and snippets.

@superlou
Created December 2, 2013 01:06
Show Gist options
  • Save superlou/7743309 to your computer and use it in GitHub Desktop.
Save superlou/7743309 to your computer and use it in GitHub Desktop.
Launch server and watch for file changes
module.exports = (grunt)->
grunt.initConfig
pkg: grunt.file.readJSON('package.json')
coffee:
compile:
options:
join: true
files:
'client/build/main.js': [
'common/src/utils.coffee'
'common/src/device.coffee'
'common/src/route.coffee'
'common/src/net.coffee'
'common/src/trunk.coffee'
'common/src/random-net.coffee'
'client/src/main.coffee'
]
'server/build/server.js': [
'server/src/requires.coffee'
'common/src/utils.coffee'
'common/src/device.coffee'
'common/src/route.coffee'
'common/src/net.coffee'
'common/src/trunk.coffee'
'common/src/random-net.coffee'
'server/src/server.coffee'
]
watch:
coffee:
files: [
'client/src/*.coffee'
'common/src/*.coffee'
'server/src/*.coffee'
]
tasks: 'coffee'
grunt.loadNpmTasks('grunt-contrib-coffee')
grunt.loadNpmTasks('grunt-contrib-watch')
grunt.loadNpmTasks('grunt-execute')
grunt.registerTask('default', ['coffee'])
grunt.registerTask('server', ->
done = this.async()
grunt.log.writeln('Starting server.')
require('./server/build/server.js').listen(8000).on('close', done)
)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment