@lopatnov/rollup-plugin-uglify

Rollup plugin. Javascript code minifier

Usage no npm install needed!

<script type="module">
  import lopatnovRollupPluginUglify from 'https://cdn.skypack.dev/@lopatnov/rollup-plugin-uglify';
</script>

README

@lopatnov/rollup-plugin-uglify Twitter

npm NPM version License GitHub issues GitHub forks GitHub stars GitHub top language

Patreon sobe.ru LinkedIn

Libraries.io dependency status for latest release

A rollup plugin to minify javascript

Requirements

Install rollup and terser first.

npm install rollup --save-dev
npm install terser --save-dev

Install

https://nodei.co/npm/@lopatnov/rollup-plugin-uglify.png?downloads=true&downloadRank=true&stars=true

npm install @lopatnov/rollup-plugin-uglify --save-dev

Import package to the project

TypeScript

import uglify from "@lopatnov/rollup-plugin-uglify";

JavaScript

var uglify = require("@lopatnov/rollup-plugin-uglify");

How to use plugin

File rollup.config.ts

export default {
  //...
  plugins: [
    //...
    uglify()
  ]
};

with options

export default {
  //...
  plugins: [
    //...
    uglify({
      //options: IUglifyOptions
    })
  ]
};

Options

uglify function has optional argument options: IUglifyOptions.

IUglifyOptions is an interface, that extends MinifyOptions of terser package.

IUglifyOptions contains:

  • include?: string | RegExp
  • exclude?: string | RegExp

A valid minimatch pattern, or array of patterns to include / exclude files. If include is omitted or has zero length, filter will return true by default. Otherwise, an ID must match one or more of the minimatch patterns, and must not match any of the exclude patterns.

Rights and Agreements

License Apache-2.0

Copyright 2019-2021 Oleksandr Lopatnov