Skip to content

Instantly share code, notes, and snippets.

@serby
Last active December 13, 2015 18:19
Show Gist options
  • Select an option

  • Save serby/4954541 to your computer and use it in GitHub Desktop.

Select an option

Save serby/4954541 to your computer and use it in GitHub Desktop.
var jade = require('jade')
, browserify = require('browserify')
, fs = require('fs')
module.exports = function (inputFile, outputFile, options) {
var b = browserify(options)
b.register('.jade', function (body, file) {
var options = { client: true, compileDebug: true, filename: file }
body = 'module.exports = ' + jade.compile(body, options).toString() + ';'
return body
})
b.prepend(fs.readFileSync(__dirname + '/../../../node_modules/jade/runtime.js', 'utf8'))
b.addEntry(inputFile)
fs.writeFileSync(outputFile, b.bundle())
}
var browjadify = require('./pliers-helpers/browjadify')
, join = require('path').join
module.exports = function (pliers) {
pliers('clean', function (done) {
pliers.rm(join(__dirname, 'public', 'js', 'build'))
done()
})
pliers('buildBrowserJs', 'clean', function (done) {
pliers.mkdirp(join(__dirname, 'public', 'js', 'build'))
browjadify(join(__dirname, 'public', 'js', 'app', 'index.js'),
join(__dirname, 'public', 'js', 'build', 'app.js'), { debug: true })
done()
})
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment