Development
Build something great, faster
Watch for changes, build for production and learn more about how _tw, WordPress and Tailwind work together
Watching for changes
During development you’ll probably want Tailwind to be watching your theme repository for changes and regenerating your style.css
file automatically:
npm run watch
The watch
command will run continuously in the background, keeping things up-to-date.
Adding custom CSS
Everything you need to configure Tailwind or to add custom CSS can be found in the ./tailwind
folder. The ./tailwind/tailwind.css
file imports a variety of other files to generate style.css
and style-editor.css
. (You should never edit those files directly, as they will be overwritten when new versions are generated.) There are comments throughout the CSS files in the ./tailwind
folder explaining what to put in each file.
JavaScript
_tw includes esbuild as its JavaScript bundler. For details on how to use it, including an example covering how to install and bundle Alpine.js, please see the dedicated documentation page on JavaScript Bundling with esbuild.
theme.json
Now with built-in theme.json
support, _tw includes a basic theme.json
file in its theme
folder. The color and width values from that file are automatically made available to Tailwind via a Tailwind plugin.
This means the top-level colors in theme.json
can be used in Tailwind (with classes like bg-primary
or text-primary
), and the values for contentSize
and wideSize
are available for setting max-width
with either max-w-content
or max-w-wide
.
Please note that if one or more of your color palette’s slug
values matches a slug in Tailwind’s default color palette, those colors from the default palette—including all shades—will be overridden by the color
value from your theme.json
file.
(Still not using the block editor? You can safely ignore the included theme.json
support entirely!)
Tailwind Typography
Tailwind Typography comes preinstalled with _tw. To learn how to set up the Typography plugin in your generated theme, please see the dedicated documentation page on using Tailwind Typography.
Tailwind plugins
Tailwind’s other first-party plugins are automatically installed when you run npm install
, but they won’t be active until you uncomment the appropriate line or lines in the plugins
block of your tailwind.config.js
file.
All Documentation
- Quickstart
Get started quickly, and deploy to production sooner than you expect
Fundamentals
- Installation
Generate your custom theme, install it in WordPress and run your first Tailwind builds - Development
Watch for changes, build for production and learn more about how _tw, WordPress and Tailwind work together - Deployment
Share your new WordPress theme with the world - Troubleshooting
Find solutions to potential issues and answers to frequently asked questions
In Depth
- Using Tailwind Typography
Customize front-end and back-end typographic styles - JavaScript Bundling with esbuild
Install and bundle JavaScript libraries (very quickly) - Linting and Code Formatting
Catch bugs and stop thinking about formatting
Extras
- On Tailwind and WordPress
Understand how WordPress and Tailwind work together - Managing Styles for Custom Blocks
Learn strategies for using Tailwind in theme-specific custom blocks - Setting Up Browsersync
Add live reloads and synchronized cross-device testing to your workflow