Skip to content

Commit

Permalink
Add WP_GATSBY_PREVIEW_DEBUG env var to enable preview debug mode (#30016
Browse files Browse the repository at this point in the history
)
  • Loading branch information
TylerBarnes committed Mar 9, 2021
1 parent 2622fd8 commit 82f2cdd
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -176,7 +176,7 @@ If post revisions are enabled on your site and previews are still not working, p

## Preview debug mode

You can enable Preview debug mode to help you debug issues with the Gatsby Preview build process. Visit the [plugin options page](https://github.com/gatsbyjs/gatsby/blob/master/packages/gatsby-source-wordpress/docs/plugin-options.md#debugpreview-boolean) to see how to enable this debug option. This option will log addition info to the terminal output including the contents of the webhook body that was sent to the Gatsby process, a list of the Preview change events Gatsby receives, as well as the node Preview data that was sourced during the Preview.
You can enable Preview debug mode to help you debug issues with the Gatsby Preview build process. Visit the [plugin options page](https://github.com/gatsbyjs/gatsby/blob/master/packages/gatsby-source-wordpress/docs/plugin-options.md#debugpreview-boolean) to see how to enable this debug option or enable this option by setting the env variable `WP_GATSBY_PREVIEW_DEBUG`. This option will log addition info to the terminal output including the contents of the webhook body that was sent to the Gatsby process, a list of the Preview change events Gatsby receives, as well as the node Preview data that was sourced during the Preview.

# Up Next :point_right:

Expand Down
5 changes: 4 additions & 1 deletion packages/gatsby-source-wordpress/src/steps/preview/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -307,9 +307,12 @@ export const sourcePreviews = async (
pluginOptions: IPluginOptions
): Promise<void> => {
const {
debug: { preview: inPreviewDebugMode },
debug: { preview: inPreviewDebugModeOption },
} = getPluginOptions()

const inPreviewDebugMode =
inPreviewDebugModeOption || process.env.WP_GATSBY_PREVIEW_DEBUG

if (inPreviewDebugMode) {
reporter.info(`Sourcing previews for the following webhook:`)
dump(webhookBody)
Expand Down

0 comments on commit 82f2cdd

Please sign in to comment.