Replies: 9 comments 7 replies
-
|
Do you have |
Beta Was this translation helpful? Give feedback.
-
|
This probably isn't exactly what you're looking for, but I managed to integrate tailwindcss V4 into a custom block, and set up a repo describing how I did it here |
Beta Was this translation helpful? Give feedback.
-
|
that's awesome , but it's too complex to me. |
Beta Was this translation helpful? Give feedback.
-
|
I got a workaround because i dont have time to dive into the rabithole of wp-scripts, i Created a block and use these steps: Make sure sure you installed postcss as well Create a eg style-tailwind.css inside your src block folder, Then in package.json i added a build:css script Its a bit of a lame fix but it works, so my block is called visual3d and has tailwind classes inside my jsx / tsx files and inside the style.css whenever i use npm run build postcss is building first, then wordpress is using the generated style.scss So to be clear, with this strategy you cant use the .scss file, but you will use your components and the style-tailwind.css (or whatever you want to call it) |
Beta Was this translation helpful? Give feedback.
-
|
I have integrated Tailwind CSS v4 into the latest WordPress Scripts package build processing, and it is working perfectly with the default watch and build commands. Note: Plugin Structure:
The source code of the package.json file is following The source code of webpack.config.js file is following. The source code of the gutenberg-tailwind.css file is following. |
Beta Was this translation helpful? Give feedback.
-
|
I have created a custom plugin that utilizes the WordPress scripts with Tailwind CSS v4 and Ant-Design inside blocks and backend-panel and frontend-panel. Plugin Structure: assets The source code of the package.json file is following The source code of webpack.config.js file is following. |
Beta Was this translation helpful? Give feedback.
-
|
It just worked for me. Followed the tailwind postcss install guide. Just had to add source on tailwind import to prevent a build infinite loop:
No webpack.config.js (i think i dont needed to add autoprefixer, and not sure if it's actually necessary to explicitly install postcss or sass) |
Beta Was this translation helpful? Give feedback.
-
|
Here's an esm version of the solution: // webpack.config.js
import tailwindcss from "@tailwindcss/postcss";
import defaultConfig from "@wordpress/scripts/config/webpack.config.js";
// Override PostCSS configuration
const loader = defaultConfig.module.rules
.find(({ test }) => test?.toString()?.includes("css"))
.use.find(({ loader }) => loader?.includes("postcss-loader"));
loader.options.postcssOptions.plugins = [tailwindcss()];
export default defaultConfig;Make sure you don't also have a |
Beta Was this translation helpful? Give feedback.
-
|
The best way i find to build Tailwind ccs Gutemberg blocks : https://github.com/Vince-ALIEN/ufo-blocks To use my blocks with your Tailwind WordPress theme just add : @source "../../../plugins/ufo-blocks/src/**/*.js"; Before your : @theme Then npm run watch, build, etc... Best regards |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
I am trying to integrate Tailwind v4 with the
wp-scriptspackage in a Plugin setting page.Steps Taken:
postcss.config.jsbased on Tailwind's recommendations.package.jsonscripts are usingwp-scriptscommands likebuildandstart.However, when I use tailwind classes in my
index.tsx, no style was appliedQuestions:
wp-scriptsin a Gutenberg project?Any help or pointers would be greatly appreciated!
Beta Was this translation helpful? Give feedback.
All reactions