Is there a way to use the method twMerge inside a component (using its attributes).
for exmaple, lets say:
<x-something class="text-4xl bg-blue />
while a $attribute->twMerge([‘class’ => ‘text-3xl font-bold uppercase bg-red’]) resolves all conflicts etc.
I know there are some php-tailwind-merge repos, but I was wondering if I could just hook another attribute into the blade’s ComponentAttributeBag and how I could possible do it.
Did you ever try using it? Sadly I had quite a few issues, setting things up (maybe it was another package, Im not quite sure).
Will check, thou Im still wondering what I would need to do, in order to use my custom methods (or hook my custom methods) inside the blade attributes.
I tried this and another one I think, thou the other one didn’t work at all.
I double checked this one and got it running (yipie), using 4.0.0 acorn, thou haven’t actually found the time to make the adjustments. I don’t know where to start honestly. It just says “twMerge does not exist”
Running into issues when moving from sage’s composer file (for acorn 4 and twMerge package) to bedrocks composer. Acorn 4.0.2 works perfectly fine on bedrock, thou for some reason once the twMerge package is installed, everything stops working (even after removing it- I have to remove the acorn package as well and re-install it)
Getting this issue:
172.18.0.2 - 06/Feb/2024:12:04:29 +0000 “GET /wp/wp-admin/index.php” 500
NOTICE: PHP message: PHP Fatal error: Cannot redeclare __() (previously declared in /var/www/html/vendor/laravel/framework/src/Illuminate/Foundation/helpers.php:952) in /var/www/html/web/wp/wp-includes/l10n.php on line 298
172.18.0.2 - 06/Feb/2024:12:04:30 +0000 “GET /wp/wp-admin/index.php” 500
Ah, it looks like that package requires laravel/framework as a dependency instead of depending on specific packages from the Illuminate namespace, which is making it incompatible with Acorn
Figured. Im running acorn from within bedrock now and use twMerge from within the sage theme’s composer file.
Maybe I’ll find a better solution in the future, but it works for now ig