GithubHelp home page GithubHelp logo

supremetechnopriest / rollup-plugin-minify-es Goto Github PK

View Code? Open in Web Editor NEW
1.0 2.0 0.0 14 KB

Rollup plugin to minify generated format into new minified file, with source maps, using uglify-es

License: MIT License

JavaScript 100.00%

rollup-plugin-minify-es's Introduction

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

rollup-plugin-minify-es's People

Contributors

supremetechnopriest avatar

Stargazers

 avatar

Watchers

 avatar  avatar

rollup-plugin-minify-es's Issues

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.