{"action":"created","comment":{"url":"https://api.github.com/repos/babel/babel.github.io/pulls/comments/76580370","id":76580370,"diff_hunk":"@@ -0,0 +1,183 @@\n+---\n+layout: post\n+title:  \"Releasing Babili (beta)\"\n+author: Henry Zhu\n+date:   2016-08-26 09:30:00\n+categories: announcements\n+share_text: \"Releasing Babili (beta)\"\n+---\n+\n+# Babili (babel-minify)\n+\n+We released [babili](https://github.com/babel/babili) as beta (0.0.1) yesterday under an MIT license!\n+\n+There are a lot of (valid) questions about why a new minifier is a good idea, so this post should help with that. We also have a [#minify](https://babeljs.slack.com/messages/minify/) slack room!\n+\n+TL;DR: Babili can output to ES2015+ code so you don't need to transpile and then minify if it's not necessary. Babili is also modular/flexible (it's a babel preset and thus supports user plugins) and can be used as a preset or cli tool. Babili should also be able to do ES2015+ specific optimizations.\n+\n+## Prounciation\n+\n+```bash\n+# sounds like \"bah billy\"\n+say babili\n+```\n+\n+\n+> If you can't remember the name, babel-minify works too.\n+\n+## Why minify?\n+\n+[Minification](https://en.wikipedia.org/wiki/Minification_(programming)) removes unncessary characeters without changing its functionality. The basics of minification remove things like comments, whitespace, newlines, and extra parentheses. You can also simplify code, transform code to smaller equivalents, remove unused code, etc.\n+\n+Minification is useful because it reduces the amount of code transferred from the server to the client. Because users download less, the page can load faster.\n+\n+## Current minifiers\n+\n+Tools such as [uglify](https://github.com/mishoo/UglifyJS2) don't currently support targeting the latest version of Javascript ([yet](https://github.com/mishoo/UglifyJS2/issues/448)).\n+\n+We currently to use tools like Babel to compile ES2015 code down to ES5 code to support older browsers. Then we use something like uglify to cut down on the bundle size.\n+\n+As browsers implement more ES2015 features and we drop support for older browser versions, there is a sliding window of the version of javascript you write in and the target javascript version you compile/minify to. However because uglify cannot parse ES2015, you would still have to compile down to ES5 anyway.\n+\n+## Babili\n+\n+That's where Babili comes in.\n+\n+Babili is ES2015+ aware because it is built using the Babel toolchain. More specifically, it is a set of babel plugins + a preset just like with the `es2015` preset.\n+\n+Like described in [Not Born to Die](http://babeljs.io/blog/2015/02/15/not-born-to-die) when Babel was renamed from 6to5, Babel was originally a specific transpiler for ES2016 to ES5. A transpiler is just a compiler so the same concepts to transform arrow functions can work to minify code.\n+\n+## Example\n+\n+When it's possible to only target browsers that support newer ES features, code sizes can be smaller because you don't have to transpile and then minify.\n+\n+For example: say we want to minify a file that contains an ES2015 class and we want to target the latest version of Chrome.\n+\n+```js\n+class Mangler {\n+  constructor(program) {\n+    this.program = program;\n+  }\n+}\n+// need this since otherwise Mangler isn't used\n+new Mangler(); \n+```\n+\n+Before, we might run Babel to transpile [the class into a function](http://babeljs.io/docs/plugins/transform-es2015-classes) and run uglify on the compiled code to send to the browser.\n+\n+```js\n+// ES2015 code -> Babel -> Uglify/Babili -> Minified ES5 Code\n+var Mangler=function a(b){_classCallCheck(this,a),this.program=b};Mangler();\n+```\n+\n+With the babel minifier, you can just run the minifier which will work on ES2015 code.\n+\n+```js\n+// ES2015 code -> Babili -> Minified ES2015 Code\n+class a{constructor(b){this.program=b}}new a;\n+```\n+\n+Also it's important to note that this isn't specific to ES2015. Because Babel updates as ECMAScript updates (with [ES2015, ES2016, and now ES2017](http://babeljs.io/docs/plugins/#official-presets)) and follows the proposal process for experimental features (with our [stage-x presets](http://babeljs.io/docs/plugins/#stage-x-experimental-presets)), the minifier should be able to output whatever version of ECMAScript that is supported.\n+\n+In addition, there are also specific optimizations we can make when we minify ES2015+ code.\n+\n+## Usage\n+\n+### Babel Preset\n+\n+If you already use Babel, you can just add the [babili](https://github.com/babel/babili#babel-preset) preset (babel-preset-babili) to your config.\n+\n+You probably want to enable this only in production, so use the [env option](http://babeljs.io/docs/usage/babelrc/#env-option) which uses either `process.env.BABEL_ENV` or `process.env.NODE_ENV`\n+\n+```bash\n+$ npm install babel-preset-babili --save-dev\n+```\n+\n+```js\n+// previous .babelrc\n+{ \"presets\": [\"es2015\"] }\n+// .babelrc\n+{\n+  \"presets\": [\"es2015\"],\n+  \"env\": {\n+    \"production\": {\n+      \"presets\": [\"babili\"]\n+    }\n+  }\n+}\n+```\n+\n+### Babili CLI\n+\n+If you don't use Babel, you can use our standalone cli tool [`babili`](https://github.com/babel/babili#cli). (Currently it's just a wrapper for babel-cli + the preset). You could run this after transpiling (or not) in place of uglify.\n+\n+```bash\n+$ npm install babili --save-dev\n+```\n+\n+```bash\n+# equivalent to \n+# babel src -d lib --presets=babili\n+$ babili src -d lib","path":"_posts/2016-08-26-babili.md","position":121,"original_position":121,"commit_id":"12d67327dd21d961579d46e9b240847d1b557897","original_commit_id":"12d67327dd21d961579d46e9b240847d1b557897","user":{"login":"mathiasbynens","id":81942,"avatar_url":"https://avatars.githubusercontent.com/u/81942?v=3","gravatar_id":"","url":"https://api.github.com/users/mathiasbynens","html_url":"https://github.com/mathiasbynens","followers_url":"https://api.github.com/users/mathiasbynens/followers","following_url":"https://api.github.com/users/mathiasbynens/following{/other_user}","gists_url":"https://api.github.com/users/mathiasbynens/gists{/gist_id}","starred_url":"https://api.github.com/users/mathiasbynens/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mathiasbynens/subscriptions","organizations_url":"https://api.github.com/users/mathiasbynens/orgs","repos_url":"https://api.github.com/users/mathiasbynens/repos","events_url":"https://api.github.com/users/mathiasbynens/events{/privacy}","received_events_url":"https://api.github.com/users/mathiasbynens/received_events","type":"User","site_admin":false},"body":"Agreed with @loganfsmyth; this surprised/confused me when I first tried babili.","created_at":"2016-08-29T09:42:56Z","updated_at":"2016-08-29T09:42:56Z","html_url":"https://github.com/babel/babel.github.io/pull/898#discussion_r76580370","pull_request_url":"https://api.github.com/repos/babel/babel.github.io/pulls/898","_links":{"self":{"href":"https://api.github.com/repos/babel/babel.github.io/pulls/comments/76580370"},"html":{"href":"https://github.com/babel/babel.github.io/pull/898#discussion_r76580370"},"pull_request":{"href":"https://api.github.com/repos/babel/babel.github.io/pulls/898"}}},"pull_request":{"url":"https://api.github.com/repos/babel/babel.github.io/pulls/898","id":82934226,"html_url":"https://github.com/babel/babel.github.io/pull/898","diff_url":"https://github.com/babel/babel.github.io/pull/898.diff","patch_url":"https://github.com/babel/babel.github.io/pull/898.patch","issue_url":"https://api.github.com/repos/babel/babel.github.io/issues/898","number":898,"state":"open","locked":false,"title":"babili","user":{"login":"hzoo","id":588473,"avatar_url":"https://avatars.githubusercontent.com/u/588473?v=3","gravatar_id":"","url":"https://api.github.com/users/hzoo","html_url":"https://github.com/hzoo","followers_url":"https://api.github.com/users/hzoo/followers","following_url":"https://api.github.com/users/hzoo/following{/other_user}","gists_url":"https://api.github.com/users/hzoo/gists{/gist_id}","starred_url":"https://api.github.com/users/hzoo/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/hzoo/subscriptions","organizations_url":"https://api.github.com/users/hzoo/orgs","repos_url":"https://api.github.com/users/hzoo/repos","events_url":"https://api.github.com/users/hzoo/events{/privacy}","received_events_url":"https://api.github.com/users/hzoo/received_events","type":"User","site_admin":false},"body":"Definitely not done but want feedback\r\n\r\n- [x] is a beta\r\n- [x] minify slack room\r\n- [x] how to help\r\n- [x] pronunciation\r\n- [x] mention es6 specific optimization/minifications\r\n- [x] webpack/bundling\r\n- [x] thanks, boopathi's minify\r\n- [ ] a section about explanation of some plugins\r\n\r\n@jayphelps @amasad @kangax, feel free to edit","created_at":"2016-08-26T18:39:56Z","updated_at":"2016-08-29T09:42:56Z","closed_at":null,"merged_at":null,"merge_commit_sha":"4432d7d5f1f945c3fffaa5351f86163de83e5507","assignee":null,"assignees":[],"milestone":null,"commits_url":"https://api.github.com/repos/babel/babel.github.io/pulls/898/commits","review_comments_url":"https://api.github.com/repos/babel/babel.github.io/pulls/898/comments","review_comment_url":"https://api.github.com/repos/babel/babel.github.io/pulls/comments{/number}","comments_url":"https://api.github.com/repos/babel/babel.github.io/issues/898/comments","statuses_url":"https://api.github.com/repos/babel/babel.github.io/statuses/12d67327dd21d961579d46e9b240847d1b557897","head":{"label":"hzoo:babili","ref":"babili","sha":"12d67327dd21d961579d46e9b240847d1b557897","user":{"login":"hzoo","id":588473,"avatar_url":"https://avatars.githubusercontent.com/u/588473?v=3","gravatar_id":"","url":"https://api.github.com/users/hzoo","html_url":"https://github.com/hzoo","followers_url":"https://api.github.com/users/hzoo/followers","following_url":"https://api.github.com/users/hzoo/following{/other_user}","gists_url":"https://api.github.com/users/hzoo/gists{/gist_id}","starred_url":"https://api.github.com/users/hzoo/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/hzoo/subscriptions","organizations_url":"https://api.github.com/users/hzoo/orgs","repos_url":"https://api.github.com/users/hzoo/repos","events_url":"https://api.github.com/users/hzoo/events{/privacy}","received_events_url":"https://api.github.com/users/hzoo/received_events","type":"User","site_admin":false},"repo":{"id":36370105,"name":"babel.github.io","full_name":"hzoo/babel.github.io","owner":{"login":"hzoo","id":588473,"avatar_url":"https://avatars.githubusercontent.com/u/588473?v=3","gravatar_id":"","url":"https://api.github.com/users/hzoo","html_url":"https://github.com/hzoo","followers_url":"https://api.github.com/users/hzoo/followers","following_url":"https://api.github.com/users/hzoo/following{/other_user}","gists_url":"https://api.github.com/users/hzoo/gists{/gist_id}","starred_url":"https://api.github.com/users/hzoo/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/hzoo/subscriptions","organizations_url":"https://api.github.com/users/hzoo/orgs","repos_url":"https://api.github.com/users/hzoo/repos","events_url":"https://api.github.com/users/hzoo/events{/privacy}","received_events_url":"https://api.github.com/users/hzoo/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/hzoo/babel.github.io","description":"Babel 5.x docs (built)","fork":true,"url":"https://api.github.com/repos/hzoo/babel.github.io","forks_url":"https://api.github.com/repos/hzoo/babel.github.io/forks","keys_url":"https://api.github.com/repos/hzoo/babel.github.io/keys{/key_id}","collaborators_url":"https://api.github.com/repos/hzoo/babel.github.io/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/hzoo/babel.github.io/teams","hooks_url":"https://api.github.com/repos/hzoo/babel.github.io/hooks","issue_events_url":"https://api.github.com/repos/hzoo/babel.github.io/issues/events{/number}","events_url":"https://api.github.com/repos/hzoo/babel.github.io/events","assignees_url":"https://api.github.com/repos/hzoo/babel.github.io/assignees{/user}","branches_url":"https://api.github.com/repos/hzoo/babel.github.io/branches{/branch}","tags_url":"https://api.github.com/repos/hzoo/babel.github.io/tags","blobs_url":"https://api.github.com/repos/hzoo/babel.github.io/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/hzoo/babel.github.io/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/hzoo/babel.github.io/git/refs{/sha}","trees_url":"https://api.github.com/repos/hzoo/babel.github.io/git/trees{/sha}","statuses_url":"https://api.github.com/repos/hzoo/babel.github.io/statuses/{sha}","languages_url":"https://api.github.com/repos/hzoo/babel.github.io/languages","stargazers_url":"https://api.github.com/repos/hzoo/babel.github.io/stargazers","contributors_url":"https://api.github.com/repos/hzoo/babel.github.io/contributors","subscribers_url":"https://api.github.com/repos/hzoo/babel.github.io/subscribers","subscription_url":"https://api.github.com/repos/hzoo/babel.github.io/subscription","commits_url":"https://api.github.com/repos/hzoo/babel.github.io/commits{/sha}","git_commits_url":"https://api.github.com/repos/hzoo/babel.github.io/git/commits{/sha}","comments_url":"https://api.github.com/repos/hzoo/babel.github.io/comments{/number}","issue_comment_url":"https://api.github.com/repos/hzoo/babel.github.io/issues/comments{/number}","contents_url":"https://api.github.com/repos/hzoo/babel.github.io/contents/{+path}","compare_url":"https://api.github.com/repos/hzoo/babel.github.io/compare/{base}...{head}","merges_url":"https://api.github.com/repos/hzoo/babel.github.io/merges","archive_url":"https://api.github.com/repos/hzoo/babel.github.io/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/hzoo/babel.github.io/downloads","issues_url":"https://api.github.com/repos/hzoo/babel.github.io/issues{/number}","pulls_url":"https://api.github.com/repos/hzoo/babel.github.io/pulls{/number}","milestones_url":"https://api.github.com/repos/hzoo/babel.github.io/milestones{/number}","notifications_url":"https://api.github.com/repos/hzoo/babel.github.io/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/hzoo/babel.github.io/labels{/name}","releases_url":"https://api.github.com/repos/hzoo/babel.github.io/releases{/id}","deployments_url":"https://api.github.com/repos/hzoo/babel.github.io/deployments","created_at":"2015-05-27T13:54:05Z","updated_at":"2016-05-29T23:50:13Z","pushed_at":"2016-08-29T03:18:07Z","git_url":"git://github.com/hzoo/babel.github.io.git","ssh_url":"git@github.com:hzoo/babel.github.io.git","clone_url":"https://github.com/hzoo/babel.github.io.git","svn_url":"https://github.com/hzoo/babel.github.io","homepage":"http://henryzoo.com/babel.github.io/","size":15678,"stargazers_count":0,"watchers_count":0,"language":"CSS","has_issues":false,"has_downloads":true,"has_wiki":true,"has_pages":true,"forks_count":1,"mirror_url":null,"open_issues_count":0,"forks":1,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"babel:master","ref":"master","sha":"d10651fb38e6abbdeafcac946ebcfd0f9585221c","user":{"login":"babel","id":9637642,"avatar_url":"https://avatars.githubusercontent.com/u/9637642?v=3","gravatar_id":"","url":"https://api.github.com/users/babel","html_url":"https://github.com/babel","followers_url":"https://api.github.com/users/babel/followers","following_url":"https://api.github.com/users/babel/following{/other_user}","gists_url":"https://api.github.com/users/babel/gists{/gist_id}","starred_url":"https://api.github.com/users/babel/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/babel/subscriptions","organizations_url":"https://api.github.com/users/babel/orgs","repos_url":"https://api.github.com/users/babel/repos","events_url":"https://api.github.com/users/babel/events{/privacy}","received_events_url":"https://api.github.com/users/babel/received_events","type":"Organization","site_admin":false},"repo":{"id":26390088,"name":"babel.github.io","full_name":"babel/babel.github.io","owner":{"login":"babel","id":9637642,"avatar_url":"https://avatars.githubusercontent.com/u/9637642?v=3","gravatar_id":"","url":"https://api.github.com/users/babel","html_url":"https://github.com/babel","followers_url":"https://api.github.com/users/babel/followers","following_url":"https://api.github.com/users/babel/following{/other_user}","gists_url":"https://api.github.com/users/babel/gists{/gist_id}","starred_url":"https://api.github.com/users/babel/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/babel/subscriptions","organizations_url":"https://api.github.com/users/babel/orgs","repos_url":"https://api.github.com/users/babel/repos","events_url":"https://api.github.com/users/babel/events{/privacy}","received_events_url":"https://api.github.com/users/babel/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/babel/babel.github.io","description":":globe_with_meridians: The Babel documentation website","fork":false,"url":"https://api.github.com/repos/babel/babel.github.io","forks_url":"https://api.github.com/repos/babel/babel.github.io/forks","keys_url":"https://api.github.com/repos/babel/babel.github.io/keys{/key_id}","collaborators_url":"https://api.github.com/repos/babel/babel.github.io/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/babel/babel.github.io/teams","hooks_url":"https://api.github.com/repos/babel/babel.github.io/hooks","issue_events_url":"https://api.github.com/repos/babel/babel.github.io/issues/events{/number}","events_url":"https://api.github.com/repos/babel/babel.github.io/events","assignees_url":"https://api.github.com/repos/babel/babel.github.io/assignees{/user}","branches_url":"https://api.github.com/repos/babel/babel.github.io/branches{/branch}","tags_url":"https://api.github.com/repos/babel/babel.github.io/tags","blobs_url":"https://api.github.com/repos/babel/babel.github.io/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/babel/babel.github.io/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/babel/babel.github.io/git/refs{/sha}","trees_url":"https://api.github.com/repos/babel/babel.github.io/git/trees{/sha}","statuses_url":"https://api.github.com/repos/babel/babel.github.io/statuses/{sha}","languages_url":"https://api.github.com/repos/babel/babel.github.io/languages","stargazers_url":"https://api.github.com/repos/babel/babel.github.io/stargazers","contributors_url":"https://api.github.com/repos/babel/babel.github.io/contributors","subscribers_url":"https://api.github.com/repos/babel/babel.github.io/subscribers","subscription_url":"https://api.github.com/repos/babel/babel.github.io/subscription","commits_url":"https://api.github.com/repos/babel/babel.github.io/commits{/sha}","git_commits_url":"https://api.github.com/repos/babel/babel.github.io/git/commits{/sha}","comments_url":"https://api.github.com/repos/babel/babel.github.io/comments{/number}","issue_comment_url":"https://api.github.com/repos/babel/babel.github.io/issues/comments{/number}","contents_url":"https://api.github.com/repos/babel/babel.github.io/contents/{+path}","compare_url":"https://api.github.com/repos/babel/babel.github.io/compare/{base}...{head}","merges_url":"https://api.github.com/repos/babel/babel.github.io/merges","archive_url":"https://api.github.com/repos/babel/babel.github.io/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/babel/babel.github.io/downloads","issues_url":"https://api.github.com/repos/babel/babel.github.io/issues{/number}","pulls_url":"https://api.github.com/repos/babel/babel.github.io/pulls{/number}","milestones_url":"https://api.github.com/repos/babel/babel.github.io/milestones{/number}","notifications_url":"https://api.github.com/repos/babel/babel.github.io/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/babel/babel.github.io/labels{/name}","releases_url":"https://api.github.com/repos/babel/babel.github.io/releases{/id}","deployments_url":"https://api.github.com/repos/babel/babel.github.io/deployments","created_at":"2014-11-09T08:29:53Z","updated_at":"2016-08-27T23:22:25Z","pushed_at":"2016-08-29T05:36:40Z","git_url":"git://github.com/babel/babel.github.io.git","ssh_url":"git@github.com:babel/babel.github.io.git","clone_url":"https://github.com/babel/babel.github.io.git","svn_url":"https://github.com/babel/babel.github.io","homepage":"https://babeljs.io/","size":16236,"stargazers_count":203,"watchers_count":203,"language":"CSS","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":true,"forks_count":345,"mirror_url":null,"open_issues_count":70,"forks":345,"open_issues":70,"watchers":203,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/babel/babel.github.io/pulls/898"},"html":{"href":"https://github.com/babel/babel.github.io/pull/898"},"issue":{"href":"https://api.github.com/repos/babel/babel.github.io/issues/898"},"comments":{"href":"https://api.github.com/repos/babel/babel.github.io/issues/898/comments"},"review_comments":{"href":"https://api.github.com/repos/babel/babel.github.io/pulls/898/comments"},"review_comment":{"href":"https://api.github.com/repos/babel/babel.github.io/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/babel/babel.github.io/pulls/898/commits"},"statuses":{"href":"https://api.github.com/repos/babel/babel.github.io/statuses/12d67327dd21d961579d46e9b240847d1b557897"}}}}
{"actor":{"display_login":"mathiasbynens"}}