{"action":"created","issue":{"url":"https://api.github.com/repos/18F/hub/issues/281","labels_url":"https://api.github.com/repos/18F/hub/issues/281/labels{/name}","comments_url":"https://api.github.com/repos/18F/hub/issues/281/comments","events_url":"https://api.github.com/repos/18F/hub/issues/281/events","html_url":"https://github.com/18F/hub/pull/281","id":72851909,"number":281,"title":"Compress Javascript files","user":{"login":"mbland","id":301547,"avatar_url":"https://avatars.githubusercontent.com/u/301547?v=3","gravatar_id":"","url":"https://api.github.com/users/mbland","html_url":"https://github.com/mbland","followers_url":"https://api.github.com/users/mbland/followers","following_url":"https://api.github.com/users/mbland/following{/other_user}","gists_url":"https://api.github.com/users/mbland/gists{/gist_id}","starred_url":"https://api.github.com/users/mbland/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mbland/subscriptions","organizations_url":"https://api.github.com/users/mbland/orgs","repos_url":"https://api.github.com/users/mbland/repos","events_url":"https://api.github.com/users/mbland/events{/privacy}","received_events_url":"https://api.github.com/users/mbland/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":5,"created_at":"2015-05-03T19:20:24Z","updated_at":"2015-05-03T23:45:42Z","closed_at":null,"pull_request":{"url":"https://api.github.com/repos/18F/hub/pulls/281","html_url":"https://github.com/18F/hub/pull/281","diff_url":"https://github.com/18F/hub/pull/281.diff","patch_url":"https://github.com/18F/hub/pull/281.patch"},"body":"cc: @afeld\r\n\r\nSince asynchronous loading was introduced in #260 and #262, we lost the\r\nJavascript compression for most scripts provided by jekyll-assets. This plugin\r\ncompresses all of the Javascript assets under `assets/js` that aren't already\r\ncompressed (i.e. end in `.min.js`).\r\n\r\nThe performance impact on `localhost:4000` may not be noticeably\r\nearth-shattering, but appears favorable, especially in terms of earlier\r\nDOMContentLoaded (blue line) and Window Load (red line) events.\r\n\r\nIn terms of the difference in file sizes across all scripts, there's an 82.3%\r\nreduction:\r\n\r\n```\r\n$ find assets -type f -name '*.js' | grep -v '\\.min\\.js' | xargs ls -l | awk\r\n'{SUM+=$5} END {print SUM}'\r\n1029992\r\n\r\n$ find _compressed -type f -name '*.js' | grep -v '\\.min\\.js' | xargs ls -l |\r\nawk '{SUM+=$5} END {print SUM}'\r\n182786\r\n\r\n$ python -c 'print 182786 / 1029992.0'\r\n0.17746351428\r\n```\r\n\r\nThe biggest file, angular.js, is 85.6% smaller:\r\n\r\n```\r\n$ ls -l angular*.js\r\n-rw-r--r--  1 _ _  113536 May  3 14:35 angular-compressed.js\r\n-rw-r--r--  1 _ _  789267 May  3 14:35 angular.js\r\n\r\n$ python -c 'print 113536/789267.0'\r\n0.143849926577\r\n```\r\n\r\nUsing command-line gzip to approximate webserver compression, compressing the\r\npre-compressed Javascript is still a significant win (78.8% smaller):\r\n\r\n```\r\n$ gzip angular*.js\r\n$ ls -l angular*.js.gz\r\n-rw-r--r--  1 _ _   41638 May  3 14:35 angular-compressed.js.gz\r\n-rw-r--r--  1 _ _  196728 May  3 14:35 angular.js.gz\r\n\r\n$ python -c 'print 41638/196728.0'\r\n0.211652637144\r\n```\r\n\r\nThese images show the performance of this change on top of #280, but this PR does not contain those changes:\r\n\r\n**Uncompressed Javascript:**\r\n\r\n![uncompressed-timeline](https://cloud.githubusercontent.com/assets/301547/7446469/94f70e40-f1a7-11e4-9d18-298d69ba823e.png)\r\n![uncompressed-network](https://cloud.githubusercontent.com/assets/301547/7446470/99aa896c-f1a7-11e4-843a-39c202d5960b.png)\r\n\r\n**Compressed Javascript:**\r\n\r\n![compressed-timeline](https://cloud.githubusercontent.com/assets/301547/7446471/a65cbb8a-f1a7-11e4-998f-bd3f8e3c7f34.png)\r\n![compressed-network](https://cloud.githubusercontent.com/assets/301547/7446473/aa2a3efe-f1a7-11e4-8a25-4499dbf0ca6e.png)\r\n"},"comment":{"url":"https://api.github.com/repos/18F/hub/issues/comments/98557598","html_url":"https://github.com/18F/hub/pull/281#issuecomment-98557598","issue_url":"https://api.github.com/repos/18F/hub/issues/281","id":98557598,"user":{"login":"coveralls","id":2354108,"avatar_url":"https://avatars.githubusercontent.com/u/2354108?v=3","gravatar_id":"","url":"https://api.github.com/users/coveralls","html_url":"https://github.com/coveralls","followers_url":"https://api.github.com/users/coveralls/followers","following_url":"https://api.github.com/users/coveralls/following{/other_user}","gists_url":"https://api.github.com/users/coveralls/gists{/gist_id}","starred_url":"https://api.github.com/users/coveralls/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/coveralls/subscriptions","organizations_url":"https://api.github.com/users/coveralls/orgs","repos_url":"https://api.github.com/users/coveralls/repos","events_url":"https://api.github.com/users/coveralls/events{/privacy}","received_events_url":"https://api.github.com/users/coveralls/received_events","type":"User","site_admin":false},"created_at":"2015-05-03T23:45:42Z","updated_at":"2015-05-03T23:45:42Z","body":"\n[![Coverage Status](https://coveralls.io/builds/2477635/badge)](https://coveralls.io/builds/2477635)\n\nCoverage increased (+0.32%) to 76.98% when pulling **208bd352876d5ea55b459a92b1a215c4b07b4485 on js-compressor** into **2b0557042cc99c074f04a741eeb5036a9ced5aaf on master**.\n"}}