payload: {"action":"created","issue":{"url":"https://api.github.com/repos/gatsbyjs/gatsby/issues/12128","repository_url":"https://api.github.com/repos/gatsbyjs/gatsby","labels_url":"https://api.github.com/repos/gatsbyjs/gatsby/issues/12128/labels{/name}","comments_url":"https://api.github.com/repos/gatsbyjs/gatsby/issues/12128/comments","events_url":"https://api.github.com/repos/gatsbyjs/gatsby/issues/12128/events","html_url":"https://github.com/gatsbyjs/gatsby/pull/12128","id":414886278,"node_id":"MDExOlB1bGxSZXF1ZXN0MjU2NDk3Mjg4","number":12128,"title":"feat(gatsby): add assetPrefix option","user":{"login":"DSchau","id":3924690,"node_id":"MDQ6VXNlcjM5MjQ2OTA=","avatar_url":"https://avatars2.githubusercontent.com/u/3924690?v=4","gravatar_id":"","url":"https://api.github.com/users/DSchau","html_url":"https://github.com/DSchau","followers_url":"https://api.github.com/users/DSchau/followers","following_url":"https://api.github.com/users/DSchau/following{/other_user}","gists_url":"https://api.github.com/users/DSchau/gists{/gist_id}","starred_url":"https://api.github.com/users/DSchau/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/DSchau/subscriptions","organizations_url":"https://api.github.com/users/DSchau/orgs","repos_url":"https://api.github.com/users/DSchau/repos","events_url":"https://api.github.com/users/DSchau/events{/privacy}","received_events_url":"https://api.github.com/users/DSchau/received_events","type":"User","site_admin":false},"labels":[{"id":1030072314,"node_id":"MDU6TGFiZWwxMDMwMDcyMzE0","url":"https://api.github.com/repos/gatsbyjs/gatsby/labels/status:%20WIP","name":"status: WIP","color":"daf282","default":false}],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":10,"created_at":"2019-02-27T00:28:52Z","updated_at":"2019-03-09T18:07:40Z","closed_at":null,"author_association":"CONTRIBUTOR","pull_request":{"url":"https://api.github.com/repos/gatsbyjs/gatsby/pulls/12128","html_url":"https://github.com/gatsbyjs/gatsby/pull/12128","diff_url":"https://github.com/gatsbyjs/gatsby/pull/12128.diff","patch_url":"https://github.com/gatsbyjs/gatsby/pull/12128.patch"},"body":"## Description\r\n\r\nIf at first you don't succeed, try, try again 😅 \r\n\r\nThe first attempt at asset prefixing went _OK_, but I think there was a fair enough amount of complexity that trying something new and hopefully simpler is valuable. Shout out to @pieh for the simpler idea here.\r\n\r\nThis PR introduces the ability to add `assetPrefix` to your gatsby-config.js. This should be a URL, and it is on the user of this functionality to ensure that assets are copied appropriately to this destination. It works with `pathPrefix`, as well, but again, slightly manual--for now!\r\n\r\nAs someone using this feature, here's how you would use it:\r\n\r\n- Add an `assetPrefix` option to your `gatsby-config.js`\r\n  ```js\r\n  module.exports = {\r\n    assetPrefix: `https://cdn.example.com`\r\n  }\r\n  ```\r\n- Continue to use functionality in your site that you've already been using, e.g. `Link`, `withPrefix`, etc. (no code or plugin changes should be required)\r\n- `__PATH_PREFIX__` will be the joined result of `assetPrefix` and `pathPrefix`\r\n\r\nAlright, alright. Now let's build this.\r\n\r\nAt _build time_, you will:\r\n\r\n- Run `gatsby build --prefix-paths` (just like you did with `pathPrefix`) and this will be respected whether using either of pathPrefix or assetPrefix\r\n    - If you're using `pathPrefix`, you'll need to copy the files in public to a nested directory (e.g. if using /blog, will need to create move /public/ to /public/blog and deploy with your hosting provider of choice)\r\n- The `public` directory is _assets_ (HTML, CSS, JS, etc.) so this can be uploaded to wherever, e.g. a CDN\r\n    - Feel free to exclude HTML, but otherwise everything in this folder should _already_ be an asset\r\n\r\nThis will create a version of your site that has its assets (CSS, JS, images, etc.) prefixed with `${assetPrefix}${pathPrefix || ''}`, so those assets will need to be deployed and available. If so--this works just fine!\r\n\r\nSee [gatsby-asset-prefix.netlify.com](https://gatsby-asset-prefix.netlify.com/blog) and the [Github Repo](https://github.com/dschau/gatsby-asset-prefix) for an example of this feature in use.\r\n\r\n## To do\r\n\r\n- [x] Add documentation for assetPrefix\r\n- [] Add more tests\r\n    - Not sure best approach of testing this e2e, but it'd be super nice to have some e2e tests for this functionality\r\n- [] Fix relative path being used with asset prefix\r\n    - [url.resolve doesn't respect relative paths for whatever reason](https://runkit.com/dschau/5c7711b616d1d00012405c7a), so will just switch to a [].join('/') or something\r\n- [x] Fix e2e test failures (they seem legitimate)\r\n- [x] Hard fail (?) when gatsby-plugin-offline is used with this feature; I _do not believe_ you can serve service workers from a separate domain\r\n    - It _may_ be possible to get this working with some custom Workbox stuff, but I think the service worker will still need to be served from the _same_ domain\r\n    - cc @davidbailey00 any insight here? Would highly appreciate it!\r\n- [] Figure out what plugins--especially third party--this could break (generally, pathPrefix is used for assets, but it is also used as a \"base path\", e.g. for links)\r\n\r\n## Related Issues\r\n\r\nFixes #2335, Fixes #8833 (need to validate this one--but pretty sure it does!)"},"comment":{"url":"https://api.github.com/repos/gatsbyjs/gatsby/issues/comments/471207239","html_url":"https://github.com/gatsbyjs/gatsby/pull/12128#issuecomment-471207239","issue_url":"https://api.github.com/repos/gatsbyjs/gatsby/issues/12128","id":471207239,"node_id":"MDEyOklzc3VlQ29tbWVudDQ3MTIwNzIzOQ==","user":{"login":"DSchau","id":3924690,"node_id":"MDQ6VXNlcjM5MjQ2OTA=","avatar_url":"https://avatars2.githubusercontent.com/u/3924690?v=4","gravatar_id":"","url":"https://api.github.com/users/DSchau","html_url":"https://github.com/DSchau","followers_url":"https://api.github.com/users/DSchau/followers","following_url":"https://api.github.com/users/DSchau/following{/other_user}","gists_url":"https://api.github.com/users/DSchau/gists{/gist_id}","starred_url":"https://api.github.com/users/DSchau/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/DSchau/subscriptions","organizations_url":"https://api.github.com/users/DSchau/orgs","repos_url":"https://api.github.com/users/DSchau/repos","events_url":"https://api.github.com/users/DSchau/events{/privacy}","received_events_url":"https://api.github.com/users/DSchau/received_events","type":"User","site_admin":false},"created_at":"2019-03-09T18:07:40Z","updated_at":"2019-03-09T18:07:40Z","author_association":"CONTRIBUTOR","body":"@davidbailey00 sweet!\r\n\r\nYeah - if we can avoid weird conditions where plugins \"just work\" with this feature, even better.\r\n\r\nThis should be in a state you can test in, so please let me know if I can help with anything. I have some instructions above for testing, as well."}}
other: {"actor":{"display_login":"DSchau"}}