We’re excited to announce that you can now configure your build plugins by deploy context.
As a refresher, deploy contexts refer to the different types of deploys of your site on Netlify, including production deploys to your primary site URL, Deploy Previews, and branch deploys built from a specific branch of your site repository.
With this new feature, you can choose which plugins run in each context, and configure plugins to run with different
inputs per context.
You can now limit a Build Plugin to run in a certain deploy context only.
Here’s an example configuration that runs the Sitemap plugin in the context of production deploys only.
[[context.production.plugins]] package = "@netlify/plugin-sitemap"
You can also configure a plugin’s
inputs settings differently per context.
Here’s an example configuration that runs the Cypress plugin differently based on deploy contexts.
[[plugins]] package = "netlify-plugin-cypress" [plugins.inputs] record = true [[context.deploy-preview.plugins]] package = "netlify-plugin-cypress" [context.deploy-preview.plugins.inputs] record = false
You can find out more in the docs: