Skip to content
This repository has been archived by the owner on Mar 16, 2020. It is now read-only.

refactor: rename babili to babel-minify #55

Merged
merged 4 commits into from
Aug 17, 2017
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

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
boopathi committed Aug 16, 2017
commit 11fc287355820154afc3615fdd77eb3487523e49
47 changes: 23 additions & 24 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

new MinifyPlugin(minifyOptions, pluginOptions)

overrides=> pluginOptions ?

]
}
```

<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: {}`

Expand All @@ -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")`.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What about minify|minifier || preset instead?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

minify or minifier sends wrong information. For example, when require("babel-minify") is passed. IMO, minifyPreset says that it's babel-preset-minify and is clear.


<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>

Expand Down Expand Up @@ -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
Loading