This repo leverages the @wordpress/scripts
package and it's ability to use PostCSS to introduce TailwindCSS to the build process.
Additionally, by using the postcss-multiple-tailwind
we are able create css files for each block that only contain the classes being used in the block.
git clone https://github.com/ryanwelcher/tailwind-multiple-blocks.git
cd tailwind-multiple-blocks
npm i
to install dependenciesOnce set up, all of the standard commands from @wordpress/scripts
will work normally:
npm start
- starts the dev build process in watch modenpm run build
- Build the files for production.src
foldertailwind.config.js
file in the new folder with content
set to the path to the new folder relative to the root - content: ['./src/FOLDER_NAME/*.{html,js}'],