Try ) // same as before, it returns `code` and `map` Options are in the form foo=bar, or just foo (the latter impliesĪ boolean option that you want to set true it's effectively a You can pass a comma-separated list of compress options. You need to pass -compress ( -c) to enable the compressor. Or -source-map "content=inline" if the source map is included inline with To use this feature pass -source-map "content='/path/to/input/source.map'" Assuming you have a mapping fromĬoffeeScript → compiled JS, Terser can generate a map from CoffeeScript →Ĭompressed JS by mapping every token in the compiled JS to its original Like to map back to the original code (i.e. When you're compressing JS code that was output by a compiler such asĬoffeeScript, mapping to the JS code won't be too helpful. The sourceĪs the source map root, and the original files as js/file1.js and The above will compress and mangle file1.js and file2.js, will drop the Otherwise Terser assumes HTTP X-SourceMap is being used and will omit the source-map "url=''" to specify the URL where the source map can be found. source-map "root=''" to pass the URL where the original files can be found. source-map "filename=''" to specify the name of the source map. source-map -output output.js (source map will be written out to Terser can generate a source map file, which is highly useful forĭebugging your compressed JavaScript. Specify -output ( -o) to declare the output file. Specify the name that your module will take Need to pass an argument to this option to “exports” and “global” variables available. wrap Embed everything in a big function, making the toplevel Compress and/or mangle variables in top level scope. timings Display operations run time on STDERR. `url` If specified, path to the source map to append in `root` Path to the original source to be included in `includeSources` Pass this flag if you want to include `filename` Name and/or location of the output source. JS that was generated from some other originalĬode. `content` Input source map, useful if you're compressing `base` Path to compute relative paths from input files. source-map Enable source map/specify source map options: safari10 Support non-standard Safari 10/11.Įquivalent to setting `safari10: true` in `minify()` name-cache File to hold mangled name mappings. If `compress` or `mangle` isĮnabled then the `toplevel` option will be enabled. keep-fnames Do not mangle/drop function names. keep-classnames Do not mangle/drop class names. ie8 Support non-standard Internet Explorer 8.Įquivalent to setting `ie8: true` in `minify()`įor `compress`, `mangle` and `format` options.īy default Terser will not try to be IE-proof. e, -enclose ] Embed output in a big function with configurable ecma Specify ECMAScript release: 5, 2015, 2016, etc. config-file Read `minify()` options from JSON file. Kept when compression is on, because of deadĬode removal or cascading statements into Note that currently not *all* comments can be a valid JS RegExp like `/foo/` or `/^!/` to Byĭefault this works like Google Closure, keeping comments Preserve copyright comments in the output. `spidermonkey` to write Terser or SpiderMonkey AST o, -output Output file path (default STDOUT). `wrap_func_args` Wrap function arguments in parenthesis. `preamble` Preamble to prepend to the output. `regex` Only mangle matched property names. `keep_quoted` Only mangle unquoted properties, quoted `builtins` Mangle property names that overlaps mangle-props Mangle properties/specify mangler options: `reserved` List of names that should not be mangled. m, -mangle Mangle names/specify mangler options: `pure_funcs` List of functions that can be safely c, -compress Enable compressor/specify compressor options: `spidermonkey` Assume input files are SpiderMonkey `expression` Parse a single expression, rather than `bare_returns` Allow return outside of functions. `-help options` for details on available options.
0 Comments
Leave a Reply. |