-
-
Save trxcllnt/2919983 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
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() |
This file contains hidden or 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
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" |
This file contains hidden or 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
define (require) -> | |
ChartableObject = require "./ChartableObject" | |
class School extends ChartableObject | |
constructor: (@enrollment) -> | |
super |
This file contains hidden or 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
module.exports = | |
class Baseclass | |
constructor: -> | |
console.log 'baseclass constructor!' |
This file contains hidden or 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
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