build
build copied to clipboard
Plugin presets
This is a follow-up on #227 and #18.
We want to allow bundles/presets of plugins.
The last solution we had was to allow plugins to return an array of objects instead of a single object. I started implementing it and realized this solution had many issues:
- There's no way for plugin presets to set the configuration of each individual plugin. Calling the plugin top-level function with a
pluginConfigobject does not work since plugin hooks also receive apluginConfigobject as argument. - Individual plugins would re-use the
idandtypefrom the plugin preset, which makes them harder to debug in logs. - There's no way for users to set the
enabled,timeout, etc. options to individual plugins - There's no way for users to set plugin configuration options if two plugins uses the same configuration property name.
Now there's a solution! Plugin presets can simply be packaged as shareable configuration. Example:
@netlify/preset-webperf would export:
plugins:
- type: '@netlify/plugin-lighthouse'
config:
currentVersion: '0.0.3'
compareWithVersion: '0.0.1'
- type: '@netlify/plugin-subfont'
- type: '@netlify/plugin-svgoptimizer'
User would use the preset like this:
extends: ['@netlify/preset-webperf']
User can override any preset's plugin configuration:
extends: ['@netlify/preset-webperf']
plugins:
- type: '@netlify/plugin-subfont'
config:
foo: bar
Done by #373.
This issue has been automatically marked as stale because it has not had activity in 1 year. It will be closed in 14 days if no further activity occurs. Thanks!
This issue was closed because it had no activity for over 1 year.