rollup-plugin-minify-es
Rollup plugin to minify generated format into new minified file, with source maps, using uglify-es.
Last updated 3 years ago by supremetechnopriest .
MIT · Repository · Bugs · Original npm · Tarball · package.json
$ cnpm install rollup-plugin-minify-es 
SYNC missed versions from official npm registry.

rollup-plugin-minify-es [![Travis Build Status][travis-img]][travis]

Rollup plugin to minify generated bundle.

Install

npm i rollup-plugin-minify-es -D

Usage

import { rollup } from 'rollup';
import minify from 'rollup-plugin-minify-es';

rollup({
    entry: 'main.js',
    plugins: [
        minify()
    ]
});

Options

minify(options)

options – default: {}, type: object. UglifyJS API options

minifier – default: require('minify-js').minify, type: function. Module to use as a minifier. You can use other versions (or forks) of UglifyJS instead default one.

import { rollup } from 'rollup';
import minify from 'rollup-plugin-minify';
import { minify } from 'minify-es';

rollup({
    entry: 'main.js',
    plugins: [
        minify({}, minify)
    ]
});

Examples

Comments

If you'd like to preserve comments (for licensing for example), then you can specify a function to do this like so:

minify({
  output: {
    comments: function(node, comment) {
        var text = comment.value;
        var type = comment.type;
        if (type == "comment2") {
            // multiline comment
            return /@preserve|@license|@cc_on/i.test(text);
        }
    }
  }
});

See UglifyJS documentation for further reference.

License

MIT

Current Tags

  • 1.1.1                                ...           latest (3 years ago)

5 Versions

  • 1.1.1                                ...           3 years ago
  • 1.0.3                                ...           3 years ago
  • 1.0.2                                ...           3 years ago
  • 1.0.1                                ...           3 years ago
  • 1.0.0                                ...           3 years ago
Maintainers (1)
Downloads
Today 0
This Week 0
This Month 9
Last Day 0
Last Week 9
Last Month 5
Dependencies (1)
Dev Dependencies (6)
Dependents (1)

Copyright 2014 - 2017 © taobao.org |