Skip to content

Instantly share code, notes, and snippets.

@adorsk
Created October 23, 2012 19:59
Show Gist options
  • Save adorsk/3941170 to your computer and use it in GitHub Desktop.
Save adorsk/3941170 to your computer and use it in GitHub Desktop.
Froth compiling, via requiring a require.js module w/ Froth configs.
fs = require('fs')
vm = require('vm')
requirejs = require('requirejs')
BASE_URL = __dirname + '/'
requireConfigPath = BASE_URL + 'js/require_config.js'
script = vm.createScript(fs.readFileSync(requireConfigPath))
sandbox = {
require: requirejs,
BASE_URL: BASE_URL,
console: console
}
script.runInNewContext(sandbox)
requirejs.config({
nodeRequire: require
})
requirejs(['froth', 'app'], (Froth, app) ->
Frothc = require('/home/adorsk/projects/froth.js/lib/frothc.coffee')
Frothc.ctx = Froth
#Frothc.config.bundling = false
Frothc.compile()
)
~
~
~
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment