Skip to content

Instantly share code, notes, and snippets.

@CoffeeAndCode
Created August 20, 2014 20:03
Show Gist options
  • Save CoffeeAndCode/ee624eda11662ab932a9 to your computer and use it in GitHub Desktop.
Save CoffeeAndCode/ee624eda11662ab932a9 to your computer and use it in GitHub Desktop.
running Exorcist with Grunt Browserify after bundle creation
// This will create a readable stream that we can pipe our bundle to Exorcist with
var stream = require('stream');
var grunt = require('grunt');
var exorcist = require('exorcist');
var createSourceMap = function(err, src, next) {
var mapfile = grunt.template.process('<%= folders.output %>/<%= filenames.js %>.map');
var s = new stream.Readable();
s._read = function noop() {};
s.push(src);
s.push(null);
s.pipe(exorcist(mapfile).on('finish', function() {
next(err, src);
}));
};
module.exports = {
development: {
options: {
bundleOptions: {
debug: true
},
postBundleCB: createSourceMap
},
dest: 'destination.js',
src: 'source.js'
}
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment