feat(plugin-clean)!: initial release#442
Conversation
|
@CharlieHelps in an earlier implementation, you tried to setup the integration with jsx-email with this plugin as a default, builtin plugin. As part of that earlier implementation, you stated that this plugin should be run before other specific plugin operations otherwise the value of this plugin would be moot, given how the minify and inline plugins operate. Break down the order of operations we should follow, and reply with that breakdown. In your reply, detail options for how we could extend the plugin contract to allow plugins to insert themselves before the execution of other plugins. We rarely want to encourage this, due to it leading to obvious chicken and egg situations, but correct me if I'm wrong that this is a rare exception. |
|
@shellscape You’re right to call this out — this is one of the rare cases where ordering is semantically important. Order of operations to follow
The key reason: Important note for current implementationIn this PR, Options to extend the plugin contract for ordering
I agree this should stay rare. Most plugins should remain order-agnostic; this is one of the exceptions where transform semantics make ordering materially important. |
|
@CharlieHelps if we change this plugin from using the afterRender hook to the beforeRender hook, would that resolve the ordering issue with core plugins and this plugin? |
|
Yes — switching I checked the current pipeline and it runs One caveat: |
|
@CharlieHelps change the plugin to use beforeRender and adjust tests. |
|
Implemented this on the PR.
Checks run:
|
Component / Package Name:
@jsx-email/plugin-clean
This PR contains:
Are tests included?
Breaking Changes?
List any relevant issue numbers:
N/A
Description
Adds the initial standalone @jsx-email/plugin-clean package at version 2.0.0.
The plugin removes unused CSS selectors and class names from rendered email HTML. It exports a configurable clean(options)
factory and a default plugin export for direct use in the plugins array of a JSX email config.
Included behavior:
This PR intentionally does not integrate the plugin into jsx-email render options or automatic core plugin loading. That
integration will be handled separately.
Docs were added for the new plugin page and plugin sidebar entry, including descriptions for each supported CleanOptions
option.