GithubHelp home page GithubHelp logo

jamesreggio / exorcist Goto Github PK

View Code? Open in Web Editor NEW

This project forked from thlorenz/exorcist

0.0 1.0 0.0 200 KB

Inline Source-map Extractor

License: MIT License

JavaScript 96.51% Shell 1.15% HTML 2.34%

exorcist's Introduction

exorcist build status

Externalizes the source map found inside a stream to an external .map file.

Works with both JavaScript and CSS input streams.

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

Usage

exorcist map_file [options]

  Externalizes the source map of the file streamed in.

  The source map is written as JSON to map_file, and the original file is streamed out with its
  sourceMappingURL set to the path of map_file (or to the value of the --url option).

OPTIONS:

  --base -b   Base path for calculating relative source paths. (default: use absolute paths)
  --root -r   Root URL for loading relative source paths. Set as sourceRoot in the source map. (default: '')
  --url  -u   Full URL to source map. Set as sourceMappingURL in the output stream. (default: map_file)

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, base) โ†’ {TransformStream}

Externalizes the source map of the file streamed in.

The source map is written as JSON to file, and the original file is streamed out with its sourceMappingURL set to the path of file (or to the value of url).

Events (in addition to stream events)

  • missing-map emitted if no map was found in the stream (the src is still 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>

full URL to the map file, set as sourceMappingURL in the streaming output (default: file)

root String <optional>

root URL for loading relative source paths, set as sourceRoot in the source map (default: '')

base String <optional>

base path for calculating relative source paths (default: use absolute paths)

Source:
Returns:

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

Type
TransformStream

generated with docme

Integration with other tools

License

MIT

exorcist's People

Contributors

jamesreggio avatar nickheiner avatar thlorenz avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.