This repository has been archived by the owner on Mar 16, 2020. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 37
refactor: rename babili
to babel-minify
#55
Merged
Changes from 1 commit
Commits
Show all changes
4 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Next
Next commit
Rename babili to babel-minify
- Loading branch information
commit 11fc287355820154afc3615fdd77eb3487523e49
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -11,35 +11,35 @@ | |
<img width="200" height="200" vspace="" hspace="25" | ||
src="https://cdn.rawgit.com/webpack/media/e7485eb2/logo/icon.svg"> | ||
</a> | ||
<h1>Babili Webpack Plugin</h1> | ||
<p>A Webpack Plugin for <a href="https://github.com/babel/babili">Babili</a> - A babel based minifier<p> | ||
<h1>Babel Minify Webpack Plugin</h1> | ||
<p>A Webpack Plugin for <a href="https://github.com/babel/minify">babel-minify</a> - A babel based minifier<p> | ||
</div> | ||
|
||
<h2 align="center">Install</h2> | ||
|
||
```bash | ||
npm install babili-webpack-plugin --save-dev | ||
npm install babel-minify-webpack-plugin --save-dev | ||
``` | ||
|
||
<h2 align="center">Usage</h2> | ||
|
||
```js | ||
// webpack.config.js | ||
const BabiliPlugin = require("babili-webpack-plugin"); | ||
const MinifyPlugin = require("babel-minify-webpack-plugin"); | ||
module.exports = { | ||
entry: //..., | ||
output: //..., | ||
plugins: [ | ||
new BabiliPlugin(babiliOptions, overrides) | ||
new MinifyPlugin(minifyOptions, overrides) | ||
] | ||
} | ||
``` | ||
|
||
<h2 align="center">Options</h2> | ||
|
||
#### babiliOptions | ||
#### minifyOptions | ||
|
||
`babiliOptions` are passed on to the babili preset. You can find a list of [all available options](https://github.com/babel/minify/tree/master/packages/babel-preset-minify#options) in the package directory. | ||
`minifyOptions` are passed on to babel-preset-minify. You can find a list of [all available options](https://github.com/babel/minify/tree/master/packages/babel-preset-minify#options) in the package directory. | ||
|
||
`Default: {}` | ||
|
||
|
@@ -50,17 +50,16 @@ module.exports = { | |
+ `sourceMap`: Default: uses [webpackConfig.devtool](https://webpack.js.org/configuration/devtool/). Set this to override that. | ||
+ `parserOpts`: Configure babel with special parser options. | ||
+ `babel`: Pass in a custom babel-core instead. `require("babel-core")` | ||
+ `babili`: Pass in a custom babili preset instead - `require("babel-preset-babili")`. | ||
`` | ||
+ `minifyPreset`: Pass in a custom minify preset instead - `require("babel-preset-minify")`. | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. What about There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. minify or minifier sends wrong information. For example, when |
||
|
||
<h2 align="center">Why</h2> | ||
|
||
You can also use [babel-loader](https://github.com/babel/babel-loader) for webpack and include `babili` [as a preset](https://github.com/babel/babili#babel-preset) and should be much faster than using this - as babili will operate on smaller file sizes. But then, why does this plugin exist at all? - | ||
You can also use [babel-loader](https://github.com/babel/babel-loader) for webpack and include `minify` [as a preset](https://github.com/babel/minify#babel-preset) and should be much faster than using this - as babel-minify will operate on smaller file sizes. But then, why does this plugin exist at all? - | ||
|
||
+ A webpack loader operates on single files and babili preset as a webpack loader is going to consider each file to be executed directly in the browser global scope (by default) and will not optimize some things in the toplevel scope. This is going to change and you can opt-in to optimize toplevel scope - [babel/babili#210](https://github.com/babel/babili/issues/210), [babel/babili#203](https://github.com/babel/babili/issues/203), etc... | ||
+ When you exclude `node_modules` from being run through the babel-loader, babili optimizations are not applied to the excluded files as it doesn't pass through the minifier. | ||
+ When you use the babel-loader with webpack, the code generated by webpack for the module system doesn't go through the loader and is not optimized by babili. | ||
+ A webpack plugin can operate on the entire chunk/bundle output and can optimize the whole bundle and you can see some differences in minified output. But this will be a lot slower as the file size is usually really huge. So there is [another idea](https://github.com/boopathi/babili-webpack-plugin/issues/8) where we can apply some optimizations as a part of the loader and some optimizations in a plugin. | ||
+ A webpack loader operates on single files and the minify preset as a webpack loader is going to consider each file to be executed directly in the browser global scope (by default) and will not optimize some things in the toplevel scope. To enable optimizations to take place in the top level scope of the file, use `topLevel: true` in minifyOptions. | ||
+ When you exclude `node_modules` from being run through the babel-loader, babel-minify optimizations are not applied to the excluded files as it doesn't pass through the minifier. | ||
+ When you use the babel-loader with webpack, the code generated by webpack for the module system doesn't go through the loader and is not optimized by babel-minify. | ||
+ A webpack plugin can operate on the entire chunk/bundle output and can optimize the whole bundle and you can see some differences in minified output. But this will be a lot slower as the file size is usually really huge. So there is [another idea](https://github.com/webpack-contrib/babel-minify-webpack-plugin/issues/8) where we can apply some optimizations as a part of the loader and some optimizations in a plugin. | ||
|
||
<h2 align="center">Maintainers</h2> | ||
|
||
|
@@ -101,20 +100,20 @@ You can also use [babel-loader](https://github.com/babel/babel-loader) for webpa | |
<tbody> | ||
</table> | ||
|
||
[npm]: https://img.shields.io/npm/v/babili-webpack-plugin.svg | ||
[npm-url]: https://npmjs.com/package/babili-webpack-plugin | ||
[npm]: https://img.shields.io/npm/v/babel-minify-webpack-plugin.svg | ||
[npm-url]: https://npmjs.com/package/babel-minify-webpack-plugin | ||
|
||
[deps]: https://david-dm.org/webpack-contrib/babili-webpack-plugin.svg | ||
[deps-url]: https://david-dm.org/webpack-contrib/babili-webpack-plugin | ||
[deps]: https://david-dm.org/webpack-contrib/babel-minify-webpack-plugin.svg | ||
[deps-url]: https://david-dm.org/webpack-contrib/babel-minify-webpack-plugin | ||
|
||
[chat]: https://img.shields.io/badge/gitter-webpack%2Fwebpack-brightgreen.svg | ||
[chat-url]: https://gitter.im/webpack/webpack | ||
|
||
[test]: https://travis-ci.org/webpack-contrib/babili-webpack-plugin.svg?branch=master | ||
[test-url]: https://travis-ci.org/webpack-contrib/babili-webpack-plugin | ||
[test]: https://travis-ci.org/webpack-contrib/babel-minify-webpack-plugin.svg?branch=master | ||
[test-url]: https://travis-ci.org/webpack-contrib/babel-minify-webpack-plugin | ||
|
||
[cover]: https://codecov.io/gh/webpack-contrib/babili-webpack-plugin/branch/master/graph/badge.svg | ||
[cover-url]: https://codecov.io/gh/webpack-contrib/babili-webpack-plugin | ||
[cover]: https://codecov.io/gh/webpack-contrib/babel-minify-webpack-plugin/branch/master/graph/badge.svg | ||
[cover-url]: https://codecov.io/gh/webpack-contrib/babel-minify-webpack-plugin | ||
|
||
[quality]: https://www.bithound.io/github/webpack-contrib/babili-webpack-plugin/badges/score.svg | ||
[quality-url]: https://www.bithound.io/github/webpack-contrib/babili-webpack-plugin | ||
[quality]: https://www.bithound.io/github/webpack-contrib/babel-minify-webpack-plugin/badges/score.svg | ||
[quality-url]: https://www.bithound.io/github/webpack-contrib/babel-minify-webpack-plugin |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
overrides
=>pluginOptions
?