Socket
Socket
Sign inDemoInstall

babel-minify

Package Overview
Dependencies
Maintainers
5
Versions
97
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

babel-minify

✂️ An ES6+ aware minifier based on the Babel toolchain (beta)


Version published
Maintainers
5
Created
Source

babel-minify

Node API and CLI

npm

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-dev

Usage

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.keepClassName

Node API

const minify = require("babel-minify");

minify(input, minifyOptions, overrides)

minifyOptions

Refer babel-preset-minify options

overrides

  • babel: Custom babel
  • minifyPreset: Custom minify preset
  • inputSourceMap: Input Sourcemap
  • sourceMaps: [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 false

Nested preset options

Usage: --optionName.featureName

Example:

minify input.js --mangle.keepClassName --deadcode.keepFnArgs --outFile input.min.js

Refer 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.

Keywords

FAQs

Package last updated on 06 May 2022

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc