https://github.com/bigpipe/plugin-minifier
Minification plugin for the compiler
https://github.com/bigpipe/plugin-minifier
Last synced: 11 months ago
JSON representation
Minification plugin for the compiler
- Host: GitHub
- URL: https://github.com/bigpipe/plugin-minifier
- Owner: bigpipe
- License: mit
- Created: 2015-06-15T12:15:59.000Z (about 11 years ago)
- Default Branch: master
- Last Pushed: 2016-11-16T20:45:08.000Z (over 9 years ago)
- Last Synced: 2025-04-13T22:59:13.555Z (about 1 year ago)
- Language: JavaScript
- Size: 7.81 KB
- Stars: 0
- Watchers: 3
- Forks: 0
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- License: LICENSE.md
Awesome Lists containing this project
README
# BigPipe - Plugin Minifier
[![Version npm][version]](http://browsenpm.org/package/bigpipe-minifier)[![Build Status][build]](https://travis-ci.org/bigpipe/plugin-minifier)[![Dependencies][david]](https://david-dm.org/bigpipe/plugin-minifier)[![Coverage Status][cover]](https://coveralls.io/r/bigpipe/plugin-minifier?branch=master)
[version]: http://img.shields.io/npm/v/bigpipe-minifier.svg?style=flat-square
[build]: http://img.shields.io/travis/bigpipe/plugin-minifier/master.svg?style=flat-square
[david]: https://img.shields.io/david/bigpipe/plugin-minifier.svg?style=flat-square
[cover]: http://img.shields.io/coveralls/bigpipe/plugin-minifier/master.svg?style=flat-square
Minification plugin for the compiler. Currently, only `uglify-js` and `clean-css`
are supported. Additional minifiers can easily be added, PR's are welcomed.
### Install
To install the plugin with the default minification tools:
```bash
npm install bigpipe-minifier uglify-js clean-css --save
```
### Usage
The tools that are used for minification have to be passed specifically. This
module deliberatly does not ship all required modules. Either a JS or CSS
minifier can be passed, or both. The properties on the configuration object will
be passed as options to the minification tool. For example, `bare_returns` and
`screw_ie8` are passed as options to `uglify-js`.
```js
var minifier = require('bigpipe-minifier')
, BigPipe = require('bigpipe');
BigPipe.createServer(8080, {
minifier: {
css: {
name: 'clean-css',
tool: require('clean-css')
},
js: {
name: 'uglify-js',
tool: require('uglify-js'),
bare_returns: true,
screw_ie8: true
}
},
plugins: [ minifier ]
});
```
The plugin will capture any emitted `register` events from the compiler and
minify the file content just before it is saved to disk.
### License
MIT