I'm trying to figure out how to implement a custom regex pattern for purging my tailwind project. The issue is that I am not using HTML elements at all, rather, I have created a PHP framework package that uses PHP functions to build HTML.
Here is an example of the PHP code I need purging:
public function view(View $v)
{
return $v->section(
$v->h1('Dashboard)->class('text-xl p-4'),
$v->p('You are logged in!')->class('p-4')
)->class('border divide-y md:w-1/2 mx-auto');
}
Here is my current tailwind config file:
module.exports = {
purge: [
'./app/Components/**/*..php',
],
darkMode: false, // or 'media' or 'class'
theme: {
extend: {},
},
variants: {
extend: {},
},
plugins: [
require('@tailwindcss/forms'),
],
}
As you can see, I've set the purge
path to my components folder, which contains all of my PHP classes.
The problem is tailwing is purging EVERYTHING. I can't figure out how to add a custom regex pattern so it will not purge items inside of the ->class()
methods.
How would I implement a purge regex pattern so I don't lose the classes used within these ->class()
methods?