{"action":"closed","number":12340,"pull_request":{"url":"https://api.github.com/repos/code-dot-org/code-dot-org/pulls/12340","id":97201339,"html_url":"https://github.com/code-dot-org/code-dot-org/pull/12340","diff_url":"https://github.com/code-dot-org/code-dot-org/pull/12340.diff","patch_url":"https://github.com/code-dot-org/code-dot-org/pull/12340.patch","issue_url":"https://api.github.com/repos/code-dot-org/code-dot-org/issues/12340","number":12340,"state":"closed","locked":false,"title":"Add support for processing images through webpack","user":{"login":"pcardune","id":124827,"avatar_url":"https://avatars.githubusercontent.com/u/124827?v=3","gravatar_id":"","url":"https://api.github.com/users/pcardune","html_url":"https://github.com/pcardune","followers_url":"https://api.github.com/users/pcardune/followers","following_url":"https://api.github.com/users/pcardune/following{/other_user}","gists_url":"https://api.github.com/users/pcardune/gists{/gist_id}","starred_url":"https://api.github.com/users/pcardune/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/pcardune/subscriptions","organizations_url":"https://api.github.com/users/pcardune/orgs","repos_url":"https://api.github.com/users/pcardune/repos","events_url":"https://api.github.com/users/pcardune/events{/privacy}","received_events_url":"https://api.github.com/users/pcardune/received_events","type":"User","site_admin":false},"body":"This PR adds support for importing/requiring images from inside js instead of just referring to \"magic\" static resource urls.\r\n\r\nHere is how this works. Given the following code:\r\n\r\n```js\r\nimport someImageUrl from './path/to/image/file.png';\r\nconst img = new Image();\r\nimg.src = someImageUrl;\r\ndocument.body.appendChild(img);\r\n```\r\n\r\nWebpack will automatically generate a javascript module for `./path/to/image/file.png` which has a single export. The single export is just a url to the image file. The url for the image comes in two possible forms:\r\n\r\n1. If the image in question is less than 10,000 bytes (this number is configurable), then the url will just be a data url that is embedded in the final javascript bundle produced by webpack.\r\n1. If the image file is larger than 10,000 bytes, then webpack will copy the image to the same output directory where all the javascript bundles get written to. The filename for the image will be an opaque unique hash based on the image file's contents. The resulting url will point to the copied image file, prefixed with the `publicPath` defined in the webpack config (currently `/assets/js/`).\r\n\r\nSince our rails assets pipeline already serves the files inside webpack's output directory, this should \"just work\" -- so long as rails does not change the filename.\r\n\r\nTodo:\r\n- [x] determine what the appropriate threshold is for images to be inlined with data urls.\r\n- [x] figure out how to stop rails from renaming the already hashed image files.","created_at":"2016-12-08T21:10:10Z","updated_at":"2016-12-13T20:33:47Z","closed_at":"2016-12-13T20:33:47Z","merged_at":"2016-12-13T20:33:47Z","merge_commit_sha":"72d4042e41f555df979505fd5428736ceb9a6ba0","assignee":null,"assignees":[],"milestone":null,"commits_url":"https://api.github.com/repos/code-dot-org/code-dot-org/pulls/12340/commits","review_comments_url":"https://api.github.com/repos/code-dot-org/code-dot-org/pulls/12340/comments","review_comment_url":"https://api.github.com/repos/code-dot-org/code-dot-org/pulls/comments{/number}","comments_url":"https://api.github.com/repos/code-dot-org/code-dot-org/issues/12340/comments","statuses_url":"https://api.github.com/repos/code-dot-org/code-dot-org/statuses/e369c4a980033902fab58602cb7ba67bdd32d279","head":{"label":"code-dot-org:pcardune-webpack-bundle-images","ref":"pcardune-webpack-bundle-images","sha":"e369c4a980033902fab58602cb7ba67bdd32d279","user":{"login":"code-dot-org","id":5124627,"avatar_url":"https://avatars.githubusercontent.com/u/5124627?v=3","gravatar_id":"","url":"https://api.github.com/users/code-dot-org","html_url":"https://github.com/code-dot-org","followers_url":"https://api.github.com/users/code-dot-org/followers","following_url":"https://api.github.com/users/code-dot-org/following{/other_user}","gists_url":"https://api.github.com/users/code-dot-org/gists{/gist_id}","starred_url":"https://api.github.com/users/code-dot-org/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/code-dot-org/subscriptions","organizations_url":"https://api.github.com/users/code-dot-org/orgs","repos_url":"https://api.github.com/users/code-dot-org/repos","events_url":"https://api.github.com/users/code-dot-org/events{/privacy}","received_events_url":"https://api.github.com/users/code-dot-org/received_events","type":"Organization","site_admin":false},"repo":{"id":24250009,"name":"code-dot-org","full_name":"code-dot-org/code-dot-org","owner":{"login":"code-dot-org","id":5124627,"avatar_url":"https://avatars.githubusercontent.com/u/5124627?v=3","gravatar_id":"","url":"https://api.github.com/users/code-dot-org","html_url":"https://github.com/code-dot-org","followers_url":"https://api.github.com/users/code-dot-org/followers","following_url":"https://api.github.com/users/code-dot-org/following{/other_user}","gists_url":"https://api.github.com/users/code-dot-org/gists{/gist_id}","starred_url":"https://api.github.com/users/code-dot-org/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/code-dot-org/subscriptions","organizations_url":"https://api.github.com/users/code-dot-org/orgs","repos_url":"https://api.github.com/users/code-dot-org/repos","events_url":"https://api.github.com/users/code-dot-org/events{/privacy}","received_events_url":"https://api.github.com/users/code-dot-org/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/code-dot-org/code-dot-org","description":"The code powering code.org and studio.code.org","fork":false,"url":"https://api.github.com/repos/code-dot-org/code-dot-org","forks_url":"https://api.github.com/repos/code-dot-org/code-dot-org/forks","keys_url":"https://api.github.com/repos/code-dot-org/code-dot-org/keys{/key_id}","collaborators_url":"https://api.github.com/repos/code-dot-org/code-dot-org/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/code-dot-org/code-dot-org/teams","hooks_url":"https://api.github.com/repos/code-dot-org/code-dot-org/hooks","issue_events_url":"https://api.github.com/repos/code-dot-org/code-dot-org/issues/events{/number}","events_url":"https://api.github.com/repos/code-dot-org/code-dot-org/events","assignees_url":"https://api.github.com/repos/code-dot-org/code-dot-org/assignees{/user}","branches_url":"https://api.github.com/repos/code-dot-org/code-dot-org/branches{/branch}","tags_url":"https://api.github.com/repos/code-dot-org/code-dot-org/tags","blobs_url":"https://api.github.com/repos/code-dot-org/code-dot-org/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/code-dot-org/code-dot-org/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/code-dot-org/code-dot-org/git/refs{/sha}","trees_url":"https://api.github.com/repos/code-dot-org/code-dot-org/git/trees{/sha}","statuses_url":"https://api.github.com/repos/code-dot-org/code-dot-org/statuses/{sha}","languages_url":"https://api.github.com/repos/code-dot-org/code-dot-org/languages","stargazers_url":"https://api.github.com/repos/code-dot-org/code-dot-org/stargazers","contributors_url":"https://api.github.com/repos/code-dot-org/code-dot-org/contributors","subscribers_url":"https://api.github.com/repos/code-dot-org/code-dot-org/subscribers","subscription_url":"https://api.github.com/repos/code-dot-org/code-dot-org/subscription","commits_url":"https://api.github.com/repos/code-dot-org/code-dot-org/commits{/sha}","git_commits_url":"https://api.github.com/repos/code-dot-org/code-dot-org/git/commits{/sha}","comments_url":"https://api.github.com/repos/code-dot-org/code-dot-org/comments{/number}","issue_comment_url":"https://api.github.com/repos/code-dot-org/code-dot-org/issues/comments{/number}","contents_url":"https://api.github.com/repos/code-dot-org/code-dot-org/contents/{+path}","compare_url":"https://api.github.com/repos/code-dot-org/code-dot-org/compare/{base}...{head}","merges_url":"https://api.github.com/repos/code-dot-org/code-dot-org/merges","archive_url":"https://api.github.com/repos/code-dot-org/code-dot-org/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/code-dot-org/code-dot-org/downloads","issues_url":"https://api.github.com/repos/code-dot-org/code-dot-org/issues{/number}","pulls_url":"https://api.github.com/repos/code-dot-org/code-dot-org/pulls{/number}","milestones_url":"https://api.github.com/repos/code-dot-org/code-dot-org/milestones{/number}","notifications_url":"https://api.github.com/repos/code-dot-org/code-dot-org/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/code-dot-org/code-dot-org/labels{/name}","releases_url":"https://api.github.com/repos/code-dot-org/code-dot-org/releases{/id}","deployments_url":"https://api.github.com/repos/code-dot-org/code-dot-org/deployments","created_at":"2014-09-20T00:46:11Z","updated_at":"2016-12-01T13:03:25Z","pushed_at":"2016-12-13T20:33:47Z","git_url":"git://github.com/code-dot-org/code-dot-org.git","ssh_url":"git@github.com:code-dot-org/code-dot-org.git","clone_url":"https://github.com/code-dot-org/code-dot-org.git","svn_url":"https://github.com/code-dot-org/code-dot-org","homepage":"http://code.org","size":5102380,"stargazers_count":152,"watchers_count":152,"language":"JavaScript","has_issues":false,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":100,"mirror_url":null,"open_issues_count":86,"forks":100,"open_issues":86,"watchers":152,"default_branch":"staging"}},"base":{"label":"code-dot-org:staging","ref":"staging","sha":"4ed95e7ac7fa33ab95ad704ca1a2e279b20324f8","user":{"login":"code-dot-org","id":5124627,"avatar_url":"https://avatars.githubusercontent.com/u/5124627?v=3","gravatar_id":"","url":"https://api.github.com/users/code-dot-org","html_url":"https://github.com/code-dot-org","followers_url":"https://api.github.com/users/code-dot-org/followers","following_url":"https://api.github.com/users/code-dot-org/following{/other_user}","gists_url":"https://api.github.com/users/code-dot-org/gists{/gist_id}","starred_url":"https://api.github.com/users/code-dot-org/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/code-dot-org/subscriptions","organizations_url":"https://api.github.com/users/code-dot-org/orgs","repos_url":"https://api.github.com/users/code-dot-org/repos","events_url":"https://api.github.com/users/code-dot-org/events{/privacy}","received_events_url":"https://api.github.com/users/code-dot-org/received_events","type":"Organization","site_admin":false},"repo":{"id":24250009,"name":"code-dot-org","full_name":"code-dot-org/code-dot-org","owner":{"login":"code-dot-org","id":5124627,"avatar_url":"https://avatars.githubusercontent.com/u/5124627?v=3","gravatar_id":"","url":"https://api.github.com/users/code-dot-org","html_url":"https://github.com/code-dot-org","followers_url":"https://api.github.com/users/code-dot-org/followers","following_url":"https://api.github.com/users/code-dot-org/following{/other_user}","gists_url":"https://api.github.com/users/code-dot-org/gists{/gist_id}","starred_url":"https://api.github.com/users/code-dot-org/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/code-dot-org/subscriptions","organizations_url":"https://api.github.com/users/code-dot-org/orgs","repos_url":"https://api.github.com/users/code-dot-org/repos","events_url":"https://api.github.com/users/code-dot-org/events{/privacy}","received_events_url":"https://api.github.com/users/code-dot-org/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/code-dot-org/code-dot-org","description":"The code powering code.org and studio.code.org","fork":false,"url":"https://api.github.com/repos/code-dot-org/code-dot-org","forks_url":"https://api.github.com/repos/code-dot-org/code-dot-org/forks","keys_url":"https://api.github.com/repos/code-dot-org/code-dot-org/keys{/key_id}","collaborators_url":"https://api.github.com/repos/code-dot-org/code-dot-org/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/code-dot-org/code-dot-org/teams","hooks_url":"https://api.github.com/repos/code-dot-org/code-dot-org/hooks","issue_events_url":"https://api.github.com/repos/code-dot-org/code-dot-org/issues/events{/number}","events_url":"https://api.github.com/repos/code-dot-org/code-dot-org/events","assignees_url":"https://api.github.com/repos/code-dot-org/code-dot-org/assignees{/user}","branches_url":"https://api.github.com/repos/code-dot-org/code-dot-org/branches{/branch}","tags_url":"https://api.github.com/repos/code-dot-org/code-dot-org/tags","blobs_url":"https://api.github.com/repos/code-dot-org/code-dot-org/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/code-dot-org/code-dot-org/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/code-dot-org/code-dot-org/git/refs{/sha}","trees_url":"https://api.github.com/repos/code-dot-org/code-dot-org/git/trees{/sha}","statuses_url":"https://api.github.com/repos/code-dot-org/code-dot-org/statuses/{sha}","languages_url":"https://api.github.com/repos/code-dot-org/code-dot-org/languages","stargazers_url":"https://api.github.com/repos/code-dot-org/code-dot-org/stargazers","contributors_url":"https://api.github.com/repos/code-dot-org/code-dot-org/contributors","subscribers_url":"https://api.github.com/repos/code-dot-org/code-dot-org/subscribers","subscription_url":"https://api.github.com/repos/code-dot-org/code-dot-org/subscription","commits_url":"https://api.github.com/repos/code-dot-org/code-dot-org/commits{/sha}","git_commits_url":"https://api.github.com/repos/code-dot-org/code-dot-org/git/commits{/sha}","comments_url":"https://api.github.com/repos/code-dot-org/code-dot-org/comments{/number}","issue_comment_url":"https://api.github.com/repos/code-dot-org/code-dot-org/issues/comments{/number}","contents_url":"https://api.github.com/repos/code-dot-org/code-dot-org/contents/{+path}","compare_url":"https://api.github.com/repos/code-dot-org/code-dot-org/compare/{base}...{head}","merges_url":"https://api.github.com/repos/code-dot-org/code-dot-org/merges","archive_url":"https://api.github.com/repos/code-dot-org/code-dot-org/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/code-dot-org/code-dot-org/downloads","issues_url":"https://api.github.com/repos/code-dot-org/code-dot-org/issues{/number}","pulls_url":"https://api.github.com/repos/code-dot-org/code-dot-org/pulls{/number}","milestones_url":"https://api.github.com/repos/code-dot-org/code-dot-org/milestones{/number}","notifications_url":"https://api.github.com/repos/code-dot-org/code-dot-org/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/code-dot-org/code-dot-org/labels{/name}","releases_url":"https://api.github.com/repos/code-dot-org/code-dot-org/releases{/id}","deployments_url":"https://api.github.com/repos/code-dot-org/code-dot-org/deployments","created_at":"2014-09-20T00:46:11Z","updated_at":"2016-12-01T13:03:25Z","pushed_at":"2016-12-13T20:33:47Z","git_url":"git://github.com/code-dot-org/code-dot-org.git","ssh_url":"git@github.com:code-dot-org/code-dot-org.git","clone_url":"https://github.com/code-dot-org/code-dot-org.git","svn_url":"https://github.com/code-dot-org/code-dot-org","homepage":"http://code.org","size":5102380,"stargazers_count":152,"watchers_count":152,"language":"JavaScript","has_issues":false,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":100,"mirror_url":null,"open_issues_count":86,"forks":100,"open_issues":86,"watchers":152,"default_branch":"staging"}},"_links":{"self":{"href":"https://api.github.com/repos/code-dot-org/code-dot-org/pulls/12340"},"html":{"href":"https://github.com/code-dot-org/code-dot-org/pull/12340"},"issue":{"href":"https://api.github.com/repos/code-dot-org/code-dot-org/issues/12340"},"comments":{"href":"https://api.github.com/repos/code-dot-org/code-dot-org/issues/12340/comments"},"review_comments":{"href":"https://api.github.com/repos/code-dot-org/code-dot-org/pulls/12340/comments"},"review_comment":{"href":"https://api.github.com/repos/code-dot-org/code-dot-org/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/code-dot-org/code-dot-org/pulls/12340/commits"},"statuses":{"href":"https://api.github.com/repos/code-dot-org/code-dot-org/statuses/e369c4a980033902fab58602cb7ba67bdd32d279"}},"merged":true,"mergeable":null,"mergeable_state":"unknown","merged_by":{"login":"pcardune","id":124827,"avatar_url":"https://avatars.githubusercontent.com/u/124827?v=3","gravatar_id":"","url":"https://api.github.com/users/pcardune","html_url":"https://github.com/pcardune","followers_url":"https://api.github.com/users/pcardune/followers","following_url":"https://api.github.com/users/pcardune/following{/other_user}","gists_url":"https://api.github.com/users/pcardune/gists{/gist_id}","starred_url":"https://api.github.com/users/pcardune/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/pcardune/subscriptions","organizations_url":"https://api.github.com/users/pcardune/orgs","repos_url":"https://api.github.com/users/pcardune/repos","events_url":"https://api.github.com/users/pcardune/events{/privacy}","received_events_url":"https://api.github.com/users/pcardune/received_events","type":"User","site_admin":false},"comments":4,"review_comments":0,"commits":8,"additions":40,"deletions":14,"changed_files":3}}
{"actor":{"display_login":"pcardune"}}