# exorcist [![build status](https://secure.travis-ci.org/thlorenz/exorcist.png)](http://travis-ci.org/thlorenz/exorcist) Externalizes the source map found inside a stream to an external `.js.map` file ```js var browserify = require('browserify') , path = require('path') , fs = require('fs') , exorcist = require('exorcist') , mapfile = path.join(__dirname, 'bundle.js.map') browserify() .require(require.resolve('./main'), { entry: true }) .bundle({ debug: true }) .pipe(exorcist(mapfile)) .pipe(fs.createWriteStream(path.join(__dirname, 'bundle.js'), 'utf8')) ``` ### command line example ``` browserify main.js --debug | exorcist bundle.js.map > bundle.js ``` **Table of Contents** *generated with [DocToc](http://doctoc.herokuapp.com/)* - [Usage](#usage) - [Installation](#installation) - [API](#api) - [Integration with other tools](#integration-with-other-tools) - [License](#license) ## Usage ``` exorcist Externalizes the source map of a file that is streamed into it by pointing it's source map url to the . The original source map is written to the as json. OPTIONS: --root -r The path to the original source to be included in the source map. (default '') --url -u The path to the source map to which to point the sourceMappingURL. (default ) EXAMPLE: Bundle main.js with browserify into bundle.js and externalize the map to bundle.js.map browserify main.js --debug | exorcist bundle.js.map > bundle.js ``` ## Installation npm install exorcist ## API

exorcist(file, url, root) → {TransformStream}

Transforms the incoming stream of code by removing the inlined source map and writing it to an external map file. Additionally it adds a source map url that points to the extracted map file.

Events (other than all stream events like error)

  • missing-map emitted if no map was found in the stream (the src still is piped through in this case, but no map file is written)
Parameters:
Name Type Argument Description
file String

full path to the map file to which to write the extracted source map

url String <optional>

allows overriding the url at which the map file is found (default: name of map file)

root String <optional>

allows adjusting the source maps sourceRoot field (default: '')

Source:
Returns:

transform stream into which to pipe the code containing the source map

Type
TransformStream
*generated with [docme](https://github.com/thlorenz/docme)*
## Integration with other tools - [using exorcist with gulp](https://github.com/thlorenz/exorcist/wiki/Recipes#gulp) ## License MIT