Package Exports
- babel-minify
- babel-minify/bin/minify
This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (babel-minify) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.
Readme
babel-minify
Node API and CLI
Use babel-minify if you don't already use babel (as a preset) or want to run it standalone.
Installation
npm install babel-minify --save-devUsage
Node API
const minify = require("babel-minify");
const {code, map} = minify("input code", {
mangle: {
keepClassName: true
}
});CLI
minify input.js --out-file input.min.js --mangle.keepClassNameNode API
const minify = require("babel-minify");
minify(input, minifyOptions, overrides)minifyOptions
Refer babel-preset-minify options
overrides
babel: Custom babelminifyPreset: Custom minify presetinputSourceMap: Input SourcemapsourceMaps: [Boolean]comments: [Function | RegExp | Boolean]
CLI Options
minify input.js [options]Simple preset options
For simple options, use --optionName in CLI
Refer preset's 1-1 options for the list of options
Example:
minify input.js --mangle falseNested preset options
Usage: --optionName.featureName
Example:
minify input.js --mangle.keepClassName --deadcode.keepFnArgs --outFile input.min.jsRefer the corresponding plugins to know the list of options it takes
IO options
--out-file path/to/file.min.js: Output filename. Used only when reading from STDIN / a single input file--out-dir path/to/dir: Output Directory.