Search: remove calypso-color-schemes and postcss-custom-properties plugin#50276
Search: remove calypso-color-schemes and postcss-custom-properties plugin#50276simison wants to merge 8 commits into
calypso-color-schemes and postcss-custom-properties plugin#50276Conversation
|
Thank you for your PR! When contributing to Jetpack, we have a few suggestions that can help us test and review your patch:
This comment will be updated as you work on your PR and make changes. If you think that some of those checks are not needed for your PR, please explain why you think so. Thanks for cooperation 🤖 Follow this PR Review Process:
If you have questions about anything, reach out in #jetpack-developers for guidance! Search plugin: No scheduled milestone found for this plugin. If you have any questions about the release process, please ask in the #jetpack-releases channel on Slack. |
1a8e5d9 to
bdf07a5
Compare
|
Are you an Automattician? Please test your changes on all WordPress.com environments to help mitigate accidental explosions.
Interested in more tips and information?
|
Code Coverage SummaryThis PR did not change code coverage! That could be good or bad, depending on the situation. Everything covered before, and still is? Great! Nothing was covered before? Not so great. 🤷 |
596bfb9 to
8d8825c
Compare
Original was: `border-bottom: 3px solid #3858e9` Before this commit: `border-bottom: 3px solid #0a112d` Now we're back to `#3858e9`
8d8825c to
dcd9068
Compare
Split out from the bigger WPDS fallback mechanism PR #50108 to simplify it.
Similar PR for VideoPress: #50121
Proposed changes
Prepares Search to better take advantage of modern core WPDS style tokens and simplifies the setup.
Remove
@automattic/calypso-color-schemesfrom Search package.--color-*token used to colour studio Sass variable instead. The actual color and built CSS stays exactly the same before/after this PR.Remove
postcss-custom-propertiesplugin:preselve: falsesetting, this was used to inline Calypso color token values directly in bundles (color: var( --color-foo )would translate tocolor: #000) to provide better browser support at the time whenvarwasn't as widely supported; see Update @automattic/calypso-build to v 5.0 #13854 (comment)). Now that we use WPDS style tokens, we intentionally want to havevar()preserved; that's how the design system works, and fallback value is there just for backwards/odd case when variable isn't available at runtime. That way e.g. color scheme changes apply across components.preselve: truesetting in Search blocks this was used to add duplicate fallbacks inline (color: #000;color: var( --token, #000 );), but with enough browser support forvar(), this isn't really needed in practice, and we'll save some bytes by stopping doing this.color: #000;color: var( --token, #000 );Adds a plugin to add WPDS token fallbacks at build-time:
color: var( --wpds-color-background-surface-neutral )→color: var( --wpds-color-background-surface-neutral, #fcfcfc ). In later PR I'll remove manually added fallbacks; they're prone to get outdated over time. See docs.Removes separate
postcss.blocks.config.jsand use the samepostcss.config.jsfor everything now that configs were basically the same.Applies
postcss.config.jsconfig to Search Dashboard as well; previously no PostCSS processing was done for Dashboard. This is particularly important because we now use WPDS tokens there and we need those fallbacks applied.AI-generated notes analysing bundles before/after
Comparison of **trunk** vs **this branch** (`1a8e5d94ff`) — production CSS across 48 files in `packages/search`.1. Bundle size
dashboardsearch-blockscustomberginstant-searchinline-searchNet: slightly larger. Dashboard PostCSS adds the most;
search-blocksshrinks from removing duplicate fallback lines.2. Token preservation in bundles (corrected counts)
--wpds-*dashboardonly--wp--preset--color--*search-blocks,inline-search--jp-search-*search-blocks--wp--*(all)--wp--preset--color--*+--wp--style--*--wp-admin-*customberg(bundled WP components CSS)--color-*(Calypso)var()usage:var()Notable preservation changes:
customberg: Branch keepsvar(--wp-admin-theme-color)instead of inlining#3858e9→ +4var()calls, +28--wp-admin-*refs.dashboard: Same 904var()refs, but branch runspostcss-ds-token-fallbacks(trunk had no PostCSS). All 188--wpds-*var()per direction now have inline fallbacks (trunk: 9 with fallback, 179 bare per direction).search-blocks/inline-search: Token refs unchanged; authored--wp--preset--color--*chains preserved as-is.3. Fallback values
Inline fallbacks —
var(--token, fallback)dashboardpostcss-ds-token-fallbacksnow appliedsearch-blocks--jp-search-*→--wp--preset--color--*chains)Branch dashboard examples:
var(--wpds-border-width-xs,1px)var(--wpds-color-stroke-surface-neutral-weak,#e0e0e0)Duplicate-line fallbacks —
prop:literal;prop:var(...)search-blocksdashboardTrunk
search-blocks(frompostcss-custom-propertieswithpreserve: true):Branch equivalent:
Remaining 4 “duplicates” on branch are not trunk-style build artifacts:
color:#f0f0f0;color:var(--jp-black)var()chains that look like duplicates in regex only4. PostCSS pipeline difference
postcss-custom-properties(+ separatepostcss.blocks.config.jswithpreserve: true)postcss-ds-token-fallbacks+ autoprefixer@automattic/calypso-color-schemesBottom line
--color-*. Real color tokens are--wp--preset--color--*(54 refs) in blocks/inline-search,--wpds-*(690 refs) in dashboard,--jp-search-*(18 refs) in blocks.Related product discussion/links
Does this pull request change what data or activity we track or use?
Testing instructions