diff options
author | Yotam Spenser <yotam.s@walkme.com> | 2016-07-06 13:02:07 +0300 |
---|---|---|
committer | Richard van Velzen <rvanvelzen1@gmail.com> | 2016-07-17 19:39:08 +0200 |
commit | af37ecafe1c24e9fb06a371357d10a04446ff71e (patch) | |
tree | 635bcbd9548c35fde2379bac57c7410901ed31f8 /README.md | |
parent | 41a9329409ca0f1273b6ccdcc9770713f44ec55a (diff) | |
download | tracifyjs-af37ecafe1c24e9fb06a371357d10a04446ff71e.tar.gz tracifyjs-af37ecafe1c24e9fb06a371357d10a04446ff71e.zip |
Source map URL override from programmatic API
Diffstat (limited to 'README.md')
-rw-r--r-- | README.md | 19 |
1 files changed, 19 insertions, 0 deletions
@@ -628,6 +628,14 @@ console.log(result.code); // minified output console.log(result.map); ``` +To generate a source map with the fromString option, you can also use an object: +```javascript +var result = UglifyJS.minify({"file1.js": "var a = function () {};"}, { + outSourceMap: "out.js.map", + fromString: true +}); +``` + Note that the source map is not saved in a file, it's just returned in `result.map`. The value passed for `outSourceMap` is only used to set the `file` attribute in the source map (see [the spec][sm-spec]). @@ -663,6 +671,17 @@ var result = UglifyJS.minify("compiled.js", { The `inSourceMap` is only used if you also request `outSourceMap` (it makes no sense otherwise). +To set the source map url, use the `sourceMapUrl` option. +If you're using the X-SourceMap header instead, you can just set the `sourceMapUrl` option to false. +Defaults to outSourceMap: + +```javascript +var result = UglifyJS.minify([ "file1.js" ], { + outSourceMap: "out.js.map", + sourceMapUrl: "localhost/out.js.map" +}); +``` + Other options: - `warnings` (default `false`) — pass `true` to display compressor warnings. |