Skip to content

nishantmendiratta/uglify-my-js

Repository files navigation

uglify-my-js

A simple cli tool to minify single javascript file

Build status

Node version Npm version install size

Installation

npm i uglify-my-js@latest

Requires Node.js v10+ to run.

Usage

Screenshot 2023-09-23 at 8 10 32 PM

Output file is generated in the current directory. It will contain minified file and source-map.

Other helpful commands

> uglifymyjs —help
> uglifymyjs —version

Usage Example

See Sample.

Dependency

The tool is built on top of uglifyjs-webpack-plugin. Following is the fixed configuration currently it is using. Feel free add new issues if you want any customization.

{
  cache: false,
  parallel: true,
  uglifyOptions: {
    compress: {
      drop_console: true,
      warnings: false,
    },
    toplevel: true,
    keep_classnames: undefined,
    keep_fnames: false,
    nameCache: null,
    output: {
      beautify: false,
      comments: false,
    },
    compress: true,
    ecma: 6,
    mangle: true,
  },
  sourceMap: true,
}

Contributing

This library is designed to support JS files - i you want to add a new language support, we'd love you to contribute them here.

Please see Coding Guidelines when writing your PRs.

File issues in the Issues tab in GitHub

Use eslint-config-wesbos

Changelog

See CHANGELOG. Follow ThatJsDev for new updates.