feat: tailwind support#686
Conversation
There was a problem hiding this comment.
Pull request overview
Integrates Tailwind CSS v4 into the existing webpack/PostCSS build pipeline as a proof-of-concept, opt-in via the presence of a single source file. Design tokens are bridged to existing theme.json CSS custom properties so Tailwind utilities stay visually aligned with WordPress block styles, and Preflight is intentionally omitted to avoid resetting block editor styles.
Changes:
- Adds
@tailwindcss/postcss(andautoprefixer,tailwindcss) dev dependencies and apostcss.config.jsenabling Tailwind v4 in PostCSS. - Adds
src/css/frontend/tailwind.csswith@theme {}mappings to--wp--preset--*tokens, and conditionally registers/enqueues the compiled stylesheet fromAssets.phponly when the source file exists. - Tightens webpack watch options to ignore
node_modulesandassets/build, and documents the Tailwind integration inDEVELOPMENT.md.
Reviewed changes
Copilot reviewed 6 out of 7 changed files in this pull request and generated 3 comments.
Show a summary per file
| File | Description |
|---|---|
| package.json | Adds tailwindcss, @tailwindcss/postcss, and autoprefixer as dev dependencies |
| package-lock.json | Lockfile regenerated; adds Tailwind/lightningcss/oxide trees and many unrelated peer-flag churn |
| postcss.config.js | New PostCSS config wiring @tailwindcss/postcss |
| src/css/frontend/tailwind.css | New Tailwind v4 entry mapping @theme tokens to WP CSS custom properties |
| webpack.config.js | Adds watchOptions to ignore node_modules and build output |
| inc/Core/Assets.php | Detects opt-in via file presence and conditionally registers/enqueues the Tailwind stylesheet |
| DEVELOPMENT.md | Documents Tailwind integration, preflight decision, and opt-in mechanism |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
aryanjasala
left a comment
There was a problem hiding this comment.
Please address the Copilot feedbacks as well
| @@ -0,0 +1,29 @@ | |||
| /* Auto-generated from theme.json by GenerateTailwindThemePlugin */ | |||
There was a problem hiding this comment.
The comment says "Auto-generated from theme.json by GenerateTailwindThemePlugin" but this file is committed to the repo and there's no such plugin in the PR.
|
|
||
| **Design tokens:** The `@theme {}` block in `tailwind.css` maps Tailwind utility names to WordPress CSS custom properties generated from `theme.json` (e.g. `--color-primary: var(--wp--preset--color--primary)`). This means tokens stay in sync with `theme.json` automatically — no manual duplication. | ||
|
|
||
| **Content detection:** Tailwind v4 automatically detects template files. No explicit content globs are needed. |
There was a problem hiding this comment.
The documentation states "Content detection automatic via Tailwind v4 — no @source directives needed" but src/css/frontend/tailwind.css line 2 explicitly has @source "../../../";. This is contradictory.
Description
Integrates Tailwind CSS v4 into the webpack build pipeline as a proof of concept.
Technical Details
postcss.config.jswith@tailwindcss/postcss— required for @wordpress/scripts to hand PostCSS control to TailwindChecklist
tailwindcssand@tailwindcss/postcssadded as dev dependenciespostcss.config.jsconfigured with @tailwindcss/postcss (autoprefixer omitted — built into v4)npm run build:prodproduces purged, production-ready CSSnpm run startwatch mode workstailwind.config.jsneeded — v4 uses CSS-first config via @theme {}Fixes/Covers issue
Fixes #644