Permalink
Browse files

Initial commit, playable prototype.

  • Loading branch information...
0 parents commit 162eb7fd9b8b77606a3b46944864aaace32c7f0d @stephank committed Dec 18, 2011
Showing with 1,059 additions and 0 deletions.
  1. +2 −0 .gitignore
  2. +35 −0 Cakefile
  3. +893 −0 game.coffee
  4. +24 −0 index.html
  5. +5 −0 levels/index.coffee
  6. +18 −0 levels/level1.coffee
  7. +22 −0 levels/level2.coffee
  8. +46 −0 levels/level3.coffee
  9. +14 −0 package.json
@@ -0,0 +1,2 @@
+/node_modules
+/game.js
@@ -0,0 +1,35 @@
+fs = require 'fs'
+connect = require 'connect'
+browserify = require 'browserify'
+uglify = require 'uglify-js'
+
+main = './game.coffee'
+
+
+option '-c', '--compress', "Enable bundle compression"
+option '-p', '--port', "Port to listen on"
+
+
+# Write a compressed bundle for static serving in production.
+task 'build', (options) ->
+ b = browserify()
+ b.register 'post', uglify if options.compress
+ b.require main, root: __dirname
+ fs.writeFileSync 'game.js', b.bundle()
+
+
+# Watch and serve using browserify, for easy developent.
+task 'serve', (options) ->
+ b = browserify mount: '/game.js'
+ b.register 'post', uglify if options.compress
+ b.require main, root: __dirname, watch: yes
+
+ server = connect.createServer()
+ server.use connect.logger()
+ server.use b
+ server.use connect.static __dirname
+
+ server.listen options.port or 20080, ->
+ { address, port } = server.address()
+ address = '127.0.0.1' if address is '0.0.0.0'
+ console.log "Listening on http://#{address}:#{port}/"
Oops, something went wrong.

0 comments on commit 162eb7f

Please sign in to comment.