This page does not have a translation yet.

In this article lets talk about Tailwind CSS support included in a theme supplied with WP BOX. For those, who is not familiar with Tailwind, this software allows you to minimise CSS usage in the project, as it is generating CSS files automatically, based on classes used in template files and optionally in other specified in the configuration file. With this approach, whenever you remove or redesign elements, old styles will also be removed automatically. Besides, minification and browser compatibility is also managed by the script during compilation.
I have described what features of Tailwind are implemented in WP BOX on page about frontend features, make sure to follow the link to see them.
Tailwind CSS is installed as a node module, and NodeJS is created as a service during installation. Basic installation doesn’t install node modules, as they are only needed for development, thus you will have to run the following command to get them:
make npm ARGS="install"
This Makefile command will run the npm script inside a container. Here is what happens under the hood: docker exec -w /var/www/site/web/app/themes/wp-box node-custom npm $(ARGS)
Alternatively you can invoke other npm commands, pass the second part of the command as ARGS string.
Theme folder contains package.json file, and after the packages will get installed, you will be able to use scripts from the package.json.
Again, the main command to start all scripts in the background is:
make start
Under the hood this command starts in parallel Tailwind CSS watch and compile job as well as other frontend pipelines.
To start only Tailwind, use this command instead:
make npm ARGS="run start-tailwind"
This command executes the following inside the NodeJS container: npx tailwindcss -i ./styles/src/tailwind.css -o ./styles/dist/tailwind.css --watch=always --minify
If you want to modify existing configuration, consider applying modifications to the following files:
Sometimes you might need to include styles from third-party libraries, or other custom CSS. There are few examples in the project – check the overrides for these core blocks:
The recommended approach depends on the scope:
block-folder/assets/css/style.min.css, as in the examples above. This file is automatically enqueued only if the block is being used on the current page.Do not modify the style.css file in the root directory of the theme. It is used only to pass WordPress check for a theme validity, and is not included in frontend.
You can find a Tailwind CSS extension for VSCode in this file – .vscode/extensions.json
Also, your VSCode might suggest installing the extensions recommended by Workspace, do so and get them. After the installation, the extension will pick up settings from .vscode/settings.json, modify them as needed.
"tailwindCSS.includeLanguages": {
"html": "html",
"javascript": "javascript",
"css": "css",
"php": "php"
},