Hi everyone!
I recently encountered a challenge when I started using Tailwind CSS in a PHP project. I needed to generate an optimized build for production, but the process wasn’t straightforward. Instead of diving into existing solutions, I created a simple script to address this problem. This script generates a output.css
file, which you can seamlessly integrate into your PHP project.
The script processes your PHP files, creates corresponding HTML mirrors, and builds a production-ready Tailwind CSS output.css
file. This is particularly useful for PHP projects where integrating Tailwind’s build tools directly may be cumbersome.
Ensure you have the following installed on your system:
Get the Script:
generate_mirror.php
file from this repository.Setup:
generate_mirror.php
file in your project directory.$phpFiles
array.Run the Script:
generate_mirror.php
file is located.php generate_mirror.php
Wait for Completion:
output.css
. This process might take a minute or two.Retrieve the CSS File:
mirror_html
folder.output.css
file and include it in your PHP project.This script was written as a quick solution, and there’s always room for improvement. If you encounter any bugs or have suggestions, please create a pull request. Your contributions and feedback are highly valued and will help make this tool even better.
Peace,
Muswalo