When To Use It#
Use Tailwind when you want most styling decisions to live directly in markup:
<section class="mx-auto max-w-5xl px-6 py-16"> <h1 class="text-5xl font-bold">{{ title }}</h1> <p class="mt-4 text-lg">{{ intro }}</p></section>You still write TemplateX source in resources/views, link CSS from your layout, and publish a normal WordPress theme.
Enable Tailwind#
In WordPress admin:
- Open TemplateX.
- Go to Settings, then Development.
- Turn on Enable Tailwind CSS.
- Wait for the autosave toast to confirm the setting.
Then run this from the active theme folder:
npm installOr:
bun installRestart development after the install:
npm run devOr:
bun run devWhat TemplateX Changes#
TemplateX adds Tailwind packages to the theme:
tailwindcss@tailwindcss/vite@tailwindcss/typographyIt also adds the Tailwind Vite plugin to vite.config.js and adds these directives to the theme CSS entry:
@import "tailwindcss";@plugin "@tailwindcss/typography";@source "../views";@source "../views" tells Tailwind to scan TemplateX source views for utility classes.
Why It Helps#
Tailwind keeps spacing, color, layout, and typography close to the HTML that uses them. That works well with TemplateX because views are already meant to stay readable and close to the page.
The published theme still contains built CSS and native WordPress PHP. It does not need Tailwind or TemplateX on the destination site.
Turning It Off#
Disabling Tailwind removes the TemplateX-managed packages, Vite plugin setup, and CSS directives.
Classes already written in templates stay in source, but Tailwind will no longer generate CSS for them.