Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/supremetechnopriest/rollup-plugin-minify-es
Rollup plugin to minify generated format into new minified file, with source maps, using uglify-es
https://github.com/supremetechnopriest/rollup-plugin-minify-es
Last synced: 29 days ago
JSON representation
Rollup plugin to minify generated format into new minified file, with source maps, using uglify-es
- Host: GitHub
- URL: https://github.com/supremetechnopriest/rollup-plugin-minify-es
- Owner: SupremeTechnopriest
- License: mit
- Created: 2017-09-12T22:51:41.000Z (about 7 years ago)
- Default Branch: master
- Last Pushed: 2017-09-15T19:23:08.000Z (about 7 years ago)
- Last Synced: 2024-09-15T01:45:35.877Z (about 2 months ago)
- Language: JavaScript
- Size: 13.7 KB
- Stars: 1
- Watchers: 2
- Forks: 0
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# rollup-plugin-minify-es [![Travis Build Status][travis-img]][travis]
[Rollup](https://github.com/rollup/rollup) plugin to minify generated bundle.
## Install
```sh
npm i rollup-plugin-minify-es -D
```## Usage
```js
import { rollup } from 'rollup';
import minify from 'rollup-plugin-minify-es';rollup({
entry: 'main.js',
plugins: [
minify()
]
});
```## Options
```js
minify(options)
````options` – default: `{}`, type: `object`. [UglifyJS API options](https://github.com/mishoo/UglifyJS2/tree/harmony#api-reference)
`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.
```js
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:
```js
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](https://github.com/mishoo/UglifyJS2/tree/harmony#keeping-comments-in-the-output) for further reference.
# License
MIT