N-011
ACF Blocks with Tailwind
30 Jun 2026 · wordpress, tailwind
This note as an agent skill: wp-acf-blocks in phucbm/skills.
Shell
This is how I build blocks for Perxel's WordPress themes. Each block is a folder in blocks/<slug>/ with its block.json, its ACF fields in fields.json and a render.php. Three mu-plugins register every block listed in blocks.json, route ACF's local JSON into each block's folder and load the Tailwind build. Scripts are *.entry.ts files that tsup compiles.
The skill is the biggest in the repo because it ships the boilerplate itself, and five commands: setup for a new theme, plan-block to turn a discussion into a GitHub issue, add-block to scaffold blocks from those issues, and two audits.
What surprised me
- ACF ignores a
fields.jsonit thinks is old. The file carries amodifiedtimestamp, and an edit that doesn't bump it is never synced into the admin. Every field change updates it (date +%s), and the audit checks it. - Two developers, one generated CSS file, constant git conflicts. Each developer builds to their own
style.<name>.generated.css, picked byTAILWIND_USER, and generated files stay out of git. - Audits catch what review misses. A block without
get_block_wrapper_attributes()on its wrapper loses the editor's alignment and classes. The fast audit is a script; the deep one also has an agent read titles, fields and empty states.