Skip to content

Instantly share code, notes, and snippets.

@trxcllnt
Forked from bclinkinbeard/gist:2919888
Created June 12, 2012 20:39
Show Gist options
  • Save trxcllnt/2919983 to your computer and use it in GitHub Desktop.
Save trxcllnt/2919983 to your computer and use it in GitHub Desktop.
window.$ = require 'jquery-browserify'
window._ = require 'underscore'
window.d3 = require 'd3-browser'
window.rx = require 'rxjs'
require.define 'base', (r, m) -> m.exports = require './main/baseclass'
require.define 'main', (r, m) -> m.exports = require './main/view'
origReq = require
window.req = (str) -> origReq.call origReq, str
Main = req 'main'
$ -> new Main()
fs = require 'fs'
path = require 'path'
{exec} = require 'child_process'
# Make sure we have our dependencies
try
colors = require 'colors'
coffee = require 'coffee-script'
browserify = require 'browserify'
catch error
console.error 'Please run `npm install` first'
process.exit 1
# Read in package.json
packageInfo = JSON.parse fs.readFileSync path.join __dirname, 'package.json'
source = 'src/bootstrapper.coffee'
bin = "bin/#{packageInfo.name}-#{packageInfo.version}.js"
task 'build', 'Compiles and minifies JavaScript file for production use', ->
# Compile
console.log "Compiling with Browserify".yellow
compiler = browserify source, require: [
"jquery-browserify"
"d3-browser"
"underscore"
]
# Write the compiled JS
fs.writeFileSync bin, compiler.bundle()
console.log "Compiled and minified #{source.green}"
console.log "#{bin}: #{fs.statSync(bin).size} bytes"
define (require) ->
ChartableObject = require "./ChartableObject"
class School extends ChartableObject
constructor: (@enrollment) ->
super
module.exports =
class Baseclass
constructor: ->
console.log 'baseclass constructor!'
module.exports =
class Main extends req('base')
constructor: ->
super
console.log 'main constructor!'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment