-
Notifications
You must be signed in to change notification settings - Fork 10.3k
chore(docs): Adapters #38233
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
chore(docs): Adapters #38233
Changes from all commits
Commits
Show all changes
16 commits
Select commit
Hold shift + click to select a range
59d1ebc
initial
LekoArts b1ff8fb
more progress
LekoArts dc9ae2c
more
LekoArts 81dfcac
add missing --verbose mention
LekoArts cf87397
finish creating guide
LekoArts d2095bd
http headers docs
LekoArts ba5aa99
Apply suggestions from code review
LekoArts af76ac2
Update docs/docs/how-to/previews-deploys-hosting/adapters.md
LekoArts 80ff8ca
review comments
LekoArts 11a7fb7
add trailingSlash and pathPrefix information
LekoArts ea9f439
add config to adapter API
LekoArts 5798146
add testing note
LekoArts b6682ff
Merge branch 'master' into docs/gatsby-adapters
LekoArts 7610cce
update version note to 5.12
LekoArts 2a62429
add supports to config hook
LekoArts 703e731
add pluginsToDisable config field
pieh File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,58 @@ | ||
| --- | ||
| title: Adapters | ||
| --- | ||
|
|
||
| ## Introduction | ||
|
|
||
| Adapters are responsible for taking the production output from Gatsby and turning it into something your deployment platform understands. They make it easier to build and deploy Gatsby sites on any deployment platform. | ||
|
|
||
| Gatsby has different [rendering options](/docs/conceptual/rendering-options/) and features like Deferred Static Generation (DSG) and Server-Side rendering (SSR) require more setup than classic static site generation (SSG). Users can also set [HTTP headers](/docs/how-to/previews-deploys-hosting/headers/) or create [redirects](/docs/reference/config-files/actions/#createRedirect). | ||
|
|
||
| Gatsby passes all the required information during the build to adapters to prepare these outputs for deployment on a specific platform. Here are some of the actions an adapter automatically takes: | ||
|
|
||
| - Applies HTTP headers to assets | ||
| - Applies redirects and rewrites. The adapter can also create its own redirects or rewrites if necessary, for example to map serverless functions to internal URLs. | ||
| - Wraps serverless functions coming from Gatsby with platform-specific code (if necessary). Gatsby will produce [Express](https://expressjs.com/)-like handlers. | ||
| - Apply trailing slash behavior and path prefix to URLs | ||
| - Possibly uploads assets to CDN | ||
|
|
||
| This feature was added in `[email protected]`. | ||
|
|
||
| ## Finding adapters | ||
|
|
||
| You can use these official adapters: | ||
|
|
||
| - [gatsby-adapter-netlify](https://github.com/gatsbyjs/gatsby/tree/master/packages/gatsby-adapter-netlify) for [Netlify](https://www.netlify.com/) | ||
|
|
||
| To find additional community adapters, [search npm for `gatsby-adapter`](https://www.npmjs.com/search?q=gatsby-adapter-). | ||
|
|
||
| Can't find an adapter for your platform? Consider [creating an adapter](/docs/how-to/previews-deploys-hosting/creating-an-adapter/) yourself. | ||
|
|
||
| ## Using adapters | ||
|
|
||
| Use the `adapter` option inside `gatsby-config`: | ||
|
|
||
| ```js:title=gatsby-config.js | ||
| const adapter = require("gatsby-adapter-foo") | ||
|
|
||
| module.exports = { | ||
| adapter: adapter() | ||
| } | ||
| ``` | ||
|
|
||
| If the adapter accepts custom options, you can set them like this: | ||
|
|
||
| ```js:title=gatsby-config.js | ||
| const adapter = require("gatsby-adapter-foo") | ||
|
|
||
| module.exports = { | ||
| adapter: adapter({ | ||
| // Adapter options | ||
| }) | ||
| } | ||
| ``` | ||
|
|
||
| ## Additional resources | ||
|
|
||
| - [Zero-Configuration Deployments](/docs/how-to/previews-deploys-hosting/zero-configuration-deployments/) | ||
| - [Creating an Adapter](/docs/how-to/previews-deploys-hosting/creating-an-adapter/) | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.