fix(build): drop the esbuild CSS syntax warning in the drafts widget - #463
Merged
AllTerrainDeveloper merged 1 commit intoJul 31, 2026
Merged
Conversation
`npm run build` emitted a `css-syntax-error` warning on every production
build of the drafts widget:
▲ [WARNING] Expected identifier but found whitespace [css-syntax-error]
136 │ .dm-drafts__spark[ aria-expanded='true' ] {
esbuild's CSS parser rejects whitespace inside attribute-selector
brackets, so it bailed on the rule and preserved it verbatim instead of
minifying it. The emitted CSS was correct either way, but the rule was
skipping the minifier and the warning was noise on every build.
Removes the inner spaces. This is the only attribute selector in any
bundled `src/**/*.css`, so nothing else is affected — the spaced form
stays fine in `assets/css/*.css` and the `*.styles.ts` shadow-DOM
literals, neither of which passes through esbuild's CSS pipeline.
esbuild now minifies the rule normally, so the tracked build output
picks up the unquoted-value normalization (`[aria-expanded=true]`),
which is equivalent CSS — `true` is a valid identifier.
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_015sKW1mu1SGg5k9oSHgxv5s
AllTerrainDeveloper
enabled auto-merge (squash)
July 31, 2026 11:42
AllTerrainDeveloper
deleted the
fix/drafts-widget-css-attr-selector-warning
branch
July 31, 2026 11:47
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
Every production build printed a
css-syntax-errorwarning:esbuild's CSS parser rejects whitespace inside attribute-selector brackets. It recovers by preserving the rule verbatim rather than minifying it, so the shipped CSS was always correct — but the rule was silently skipping the minifier, and the warning was noise on every single build.
Fix
Removed the inner spaces in
src/plugins/drafts-widget/styles.css:136.This is the only attribute selector in any bundled
src/**/*.css, so nothing else in the tree is affected. The spaced WP-style form remains fine inassets/css/*.css(enqueued raw) and in the*.styles.tsshadow-DOM literals (JS template strings) — neither passes through esbuild's CSS pipeline.Build-output diff
Now that esbuild parses the rule, it minifies it normally and applies its usual unquoted-value normalization:
Equivalent CSS —
trueis a valid identifier, so quotes are optional. Diffed the rest of the minified bundle rule-by-rule; that line is the only change.Verification
npm run build— clean, zero warnings across all targetsnpm run lint— passnpm run typecheck— passnpm run test:js— 2744 tests / 272 files, all passNo PHP touched.
🤖 Generated with Claude Code
https://claude.ai/code/session_015sKW1mu1SGg5k9oSHgxv5s