Style: Replace Grunt with @wordpress/scripts and modernize the build - #734
Style: Replace Grunt with @wordpress/scripts and modernize the build#734obenland wants to merge 5 commits into
Conversation
d1d8266 to
6b014cc
Compare
7b64e37 to
8de956a
Compare
Brings trac/ in line with the formatting and lint rules from WordPress#734, ahead of that PR, so the same files do not need touching again when it lands and the assets only need deploying once. Retires the jinja2 compatibility shim: its rules now live in wp-trac.css and the templates no longer load the removed script and stylesheet. trac-search.js goes with it, unused since its include was removed in r7275. Builds markup through the DOM rather than by string concatenation in the attachment preview, the reopen notice, the non-gardener type field and the attachment autocomplete, and restores the preserved attribute matches by index so a comment cannot shift the restore queue. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
06d8578 to
78af7f7
Compare
- Swap Grunt/JSHint for @wordpress/scripts (build, lint-js, format), with a webpack config that builds js/navigation.min.js in place and a small bin/build-rtl.js for the RTL stylesheet, keeping the Dashicons arrow swap RTLCSS cannot infer. - Adopt the default WordPress code style (Prettier at a 120 line length) and fix all ESLint errors; convert HTML-building string concatenation to template literals and query building to URLSearchParams. - Update browser targets to @wordpress/browserslist-config, matching the rest of WordPress.org, and drop the vendor prefixes nothing supported needs anymore, along with the Autoprefixer pass and the self-referential wp4.css.map. - Remove trac/trac-search.js, unused since its include was removed in r7275. - Document the directory in README.md, trac/README.md, and AGENTS.md (with a CLAUDE.md wrapper): file inventory, development flow, testing Trac changes via DevTools overrides, and the deploy + scripts_version bump process.
78af7f7 to
8cf0c43
Compare
Runs on changes to JS or CSS under wordpress.org/public_html/style/ and fails when the tooling wasn't run: ESLint errors, unformatted files, or committed build output (wp4-rtl.css, js/navigation.min.js) that is out of sync with its source.
Their behavior now lives in wp-trac.js and wp-trac.css; remove the files, their template includes, and their README entries. scripts_version is deliberately untouched: per the documented deploy flow it gets bumped in a follow-up commit once the merged assets are deployed, so the CDN never caches a stale file under the new version. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_015Nm6k2sd9zv3aRZZZt6XCp
Adds wp-scripts lint-style (the stock @wordpress/stylelint-config) as npm run lint:css, wired into the CI workflow, and conforms wp4.css and trac/wp-trac.css to it. Prettier ignores *.css, so stylelint owns CSS formatting outright. The fixes are rendering-identical: formatting, notation (::before, bold=700, named colors to hex, quote style), dropped declarations that a later duplicate in the same block already overrode, and generic font-family fallbacks — including 'Open Sans', "sans serif", which quoted the generic keyword into a nonexistent font name. Cascade-affecting rules (selector reordering/merging, renaming the Trac and WP.org markup's own ids and classes, unit conversions) are disabled in .stylelintrc.js. Vendored, generated, and frozen legacy stylesheets are excluded via .stylelintignore; wp4-rtl.css is rebuilt from the conformed wp4.css. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_015Nm6k2sd9zv3aRZZZt6XCp
Chrome stores DevTools local overrides with the query string in the file name and only matches that exact name; hand-placed files without it are silently ignored, as are tabs without an open DevTools window. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_015Nm6k2sd9zv3aRZZZt6XCp
8cf0c43 to
00a8621
Compare
|
The following accounts have interacted with this PR and/or linked issues. I will continue to update these lists as activity occurs. You can also manually ask me to refresh this list by adding the Core Committers: Use this line as a base for the props when committing in SVN: To understand the WordPress project's expectations around crediting contributors, please review the Contributor Attribution page in the Core Handbook. |
There was a problem hiding this comment.
Pull request overview
Modernizes the build and maintenance workflow for wordpress.org/public_html/style/ by migrating from Grunt/JSHint to @wordpress/scripts, regenerating committed build artifacts accordingly, and adding CI checks to prevent drift and enforce lint/format rules for the Style assets.
Changes:
- Replace Grunt/JSHint tooling with
@wordpress/scripts-based build/lint/format commands and updated browser targets. - Introduce a custom webpack config and a Node-based RTL build script, committing regenerated outputs (
wp4-rtl.css,js/navigation.min.js). - Add documentation for the Style and Trac asset workflows plus a dedicated GitHub Actions workflow for lint/format/build-drift checks.
Reviewed changes
Copilot reviewed 17 out of 21 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
| wordpress.org/public_html/style/wp4.css.map | Removes the committed source map output. |
| wordpress.org/public_html/style/wp4.css | Updates CSS output (formatting/normalization, vendor-prefix removal, mapping comment removal). |
| wordpress.org/public_html/style/wp4-rtl.css | Updates committed RTL build output to match the new pipeline. |
| wordpress.org/public_html/style/webpack.config.js | Customizes @wordpress/scripts webpack output to build js/navigation.min.js in-place. |
| wordpress.org/public_html/style/trac/README.md | Documents Trac-specific static assets and deployment/version-bump workflow. |
| wordpress.org/public_html/style/README.md | Documents Style directory inventory, local dev commands, and deployment workflow. |
| wordpress.org/public_html/style/package.json | Switches to @wordpress/scripts tooling, adds browserslist, and defines build/lint/format scripts. |
| wordpress.org/public_html/style/js/navigation.min.js | Updates committed minified navigation script output. |
| wordpress.org/public_html/style/js/navigation.js | Modernizes the navigation script source to satisfy @wordpress/scripts lint/style expectations. |
| wordpress.org/public_html/style/Gruntfile.js | Removes legacy Grunt build configuration. |
| wordpress.org/public_html/style/CLAUDE.md | Adds a wrapper pointing tooling/agent guidance to AGENTS.md. |
| wordpress.org/public_html/style/bin/build-rtl.js | Adds a Node script to generate wp4-rtl.css from wp4.css (RTL build step). |
| wordpress.org/public_html/style/AGENTS.md | Adds directory-specific contributor/agent workflow rules and commands. |
| wordpress.org/public_html/style/.stylelintrc.js | Adds Stylelint configuration extending WordPress defaults with local rule relaxations. |
| wordpress.org/public_html/style/.stylelintignore | Adds Stylelint ignore rules for vendored/frozen/generated assets. |
| wordpress.org/public_html/style/.prettierrc.js | Adds a Prettier config extending WordPress defaults with printWidth: 120. |
| wordpress.org/public_html/style/.prettierignore | Excludes generated/minified/CSS (and vendored Trac assets) from Prettier formatting. |
| wordpress.org/public_html/style/.jshintrc | Removes legacy JSHint configuration. |
| wordpress.org/public_html/style/.jshintignore | Removes legacy JSHint ignore configuration. |
| .github/workflows/style-lint.yml | Adds CI workflow to lint/format and verify generated files are up-to-date for Style changes. |
Suppressed comments (2)
wordpress.org/public_html/style/js/navigation.js:22
document.getElementById()returnsnullwhen an element is missing, notundefined. The currenttypeofchecks won’t catch a missing#mobile-menu-buttonor#wporg-header-menu, and the code will then throw when accessing properties onnull.
const button = document.getElementById( 'mobile-menu-button' );
if ( 'undefined' === typeof button ) {
return;
}
const menu = document.getElementById( 'wporg-header-menu' );
// Hide menu toggle button if menu is empty and return early.
if ( 'undefined' === typeof menu ) {
button.style.display = 'none';
return;
}
.github/workflows/style-lint.yml:16
- Same as the PR trigger: the push path filters should use
**/*.js/**/*.cssso nested files understyle/are included.
- 'wordpress.org/public_html/style/**.js'
- 'wordpress.org/public_html/style/**.css'
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
| - 'wordpress.org/public_html/style/**.js' | ||
| - 'wordpress.org/public_html/style/**.css' |
| | `npm run build` | Runs `build:css` and `build:js`. | | ||
| | `npm run build:css` | Regenerates `wp4-rtl.css` from `wp4.css` via `bin/build-rtl.js`. The RTL pass includes a plugin that swaps Dashicons left/right arrow glyphs, which RTLCSS cannot infer from the CSS itself. | | ||
| | `npm run build:js` | Builds `js/navigation.js` into `js/navigation.min.js` (webpack via `wp-scripts build`, see `webpack.config.js`). Transpilation targets come from the `browserslist` field in `package.json`, which extends the official `@wordpress/browserslist-config`. | | ||
| | `npm run format` | Formats all source files with Prettier (`wp-scripts format`). | |
Modernizes the build tooling and code style for
wordpress.org/public_html/style/, and adds CI coverage for it.Tooling
@wordpress/scripts33:npm run build/build:css/build:js/format/lint:js.js/navigation.min.jsis built in place by webpack (webpack.config.js);wp4-rtl.cssby a smallbin/build-rtl.js, preserving the Dashicons arrow-swap and@importrenaming that RTLCSS can't infer and thatwp-scripts' built-in RTL support can't express.@wordpress/browserslist-config, matching the wporg-*-2024 themes, replacing the 2013-era list (IE 7+, Android 2.1+). Autoprefixer and the self-referentialwp4.css.mapare dropped: under current targets the stylesheet needs no generated prefixes (the few remaining-webkit-/-moz-occurrences are intentional non-standard properties).Code style
style/(includingtrac/) now passes the stock@wordpress/scriptsESLint ruleset with zero errors, and is Prettier-formatted with a single local override (printWidth: 120).URLSearchParams(which also percent-encodes values that previously went onto the wire raw).trac/trac-search.js, dead since its include was removed in r7275 (2018) — its API endpoint no longer exists.CI
style-lint.ymlworkflow runs on changes to JS/CSS understyle/: ESLint,prettier --check, and a build-drift check that fails when committed build output (wp4-rtl.css,js/navigation.min.js) is out of sync with its source.Docs
README.md,trac/README.md, andAGENTS.md(with aCLAUDE.mdwrapper): file inventory, development flow, testing Trac changes via DevTools local overrides, and the deploy flow (commit + sandbox deploy, then the follow-upscripts_versionbump in both Trac templates).Verification
wp4.cssbuilds byte-identical under the new pipeline before the browserslist change; the RTL diff beyond that consists of drift the old pipeline had accumulated plus the prefix removal.npm run lint:js,npx prettier --check .,node --checkon all sources, and a fullnpm run buildidempotency check all pass.Note for deployment: the changes to
trac/*.jswill need the usualscripts_versionbump insite_head.html/site_footer.htmlas a follow-up commit once the assets are deployed.🤖 Generated with Claude Code