Tailwind Gutenberg Bridge
Integrated tailwind support for Wordpress
★ 1stars
0forks
Install
No release zip yet. The repository archive installs, but the folder name will carry the branch suffix and updates will not flow:
wp plugin install https://github.com/kradyy/wordpress-twbg/archive/refs/heads/main.zipTailwind Gutenberg Bridge (TWGB)
Tailwind Gutenberg Bridge adds a Tailwind-first workflow to Gutenberg with core-block extensions, a lightweight custom SVG block, and per-post compiled CSS output.
Features
- Tailwind support for core Gutenberg blocks via
twgbTailwind.cx - Tailwind classes applied server-side on rendered block root elements
- Inspector UI for Tailwind editing on core blocks
- Device toggles:
Desktop,Tablet,Mobile Class Stringinput- Categorized token fields:
Spacing,Sizing,Typography,Layout,Colors,Effects,Other
- Device toggles:
- List View Tailwind indicator icon on blocks with Tailwind classes
TW SVGblock (twgb/tw-svg) for inline SVG markup with Tailwind classes- Editor More menu tool: Import Tailwind HTML
- Editor-only Tailwind JIT using
@tailwindcss/browser@4 - Compiled Tailwind CSS saved per post in
_twgb_compiled_css - Frontend CSS injected inline with
wp_add_inline_style()
Requirements
- WordPress 6.0+
- PHP 7.4+
Installation
- Copy this plugin to
wp-content/plugins/tw-blocks - Activate Tailwind Gutenberg Bridge in WordPress admin
- (Optional) Go to
Settings > TW Blocksand confirm editor JIT is enabled
Usage
Add Tailwind to core blocks
- Insert a core block (for example
Group,Columns,Heading,Paragraph) - Open the block sidebar
- Use the Tailwind (TWGB) panel to add classes
- Save the post
Import Tailwind HTML
- Open editor menu (
⋮) and click Import Tailwind HTML - Paste HTML
- Import to generate Gutenberg blocks
Use TW SVG
- Insert
TW SVG - Paste
<svg>...</svg>markup - Add Tailwind classes and optional ARIA label
Gutenberg vs TW
- Tailwind wins over Gutenberg defaults.
- Gutenberg wins when a client/user changes a block control.
- Tailwind wins again when a developer marks a class important with
!. - Important classes can be written as
!text-red-500,hover:!text-red-500,text-red-500!, orhover:text-red-500!. - Important TW labels are shown with a light red background in the editor.
REST API
| Route | Method | Purpose |
|---|---|---|
/wp-json/twgb/v1/parse |
POST |
Parse Tailwind HTML into block descriptors |
/wp-json/twgb/v1/save-post-css |
POST |
Save compiled post CSS to _twgb_compiled_css |
Data Model
{
"twgbTailwind": {
"cx": "hidden md:block p-6"
}
}
Post-level compiled CSS is stored in:
post_meta key: _twgb_compiled_css
Project Structure
tw-blocks/
├── tailwind-gutenberg-bridge.php
├── includes/class-twgb-loader.php
├── blocks/tw-svg/
├── assets/js/twgb-editor.js
├── assets/js/twgb-class-utils.js
├── assets/css/twgb-editor.css
├── assets/css/twgb-frontend.css
├── parser/class-twgb-parser.php
├── renderer/class-twgb-renderer.php
├── tailwind-engine/class-twgb-class-intelligence.php
└── LICENSE
License
Proprietary. See LICENSE.