-
Notifications
You must be signed in to change notification settings - Fork 11
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[BUG] How to add Tailwind css globally with basset? #116
Comments
Hey @blondie63 Try this(assuming you are using theme-tabler):
php artisan vendor:publish --tag="theme-tabler-config"
'styles' => [
base_path('vendor/backpack/theme-tabler/resources/assets/css/color-adjustments.css'),
base_path('vendor/backpack/theme-tabler/resources/assets/css/colors.css'),
+ 'https://cdn.example.com/version.css'
+ 'https://cdn.tailwindcss.com/3.4.3'
], While doing it, I found a Bug. I'm assigning my colleague @pxpm to fix this: BUGWhile adding |
Hey @karandatwani92 thanks for the heads up. I acknowledged that at the moment it's not possible to load urls without extension that easily. For @blondie63 a "quick" workaround is to create a file in your I will leave here also for future me and anybody that may have interest in this topic what I've tried/found while researching this. I didn't came up with something I would be happy with. (I mean, small changes and not hacking a solution). I think this may need some refactoring on basset workflow to be properly supported. When you give an url without We can get the Something along the following lines: if(Str::isUrl($path)) {
$response = Http::get($path);
$contentType = $response->header('content-type') ?? '';
if(Str::contains($contentType, 'javascript')){
$this->echoJs($path, $attributes);
}else if(Str::contains($contentType, 'css')){
$this->echoCss($path, $attributes);
}
} When in dev-mode this is cumbersome, 2 requests for the same asset. Maybe with an option to internalize external assets, even in dev mode like I suggested in #114 I tried appending I think @promatik can help here. |
Yes, this is a known limitation. By not having the the file extension it also makes it complex Anyway, @pxpm your solution would be nice, but in that case, that file is not of the type "javascript". I think the only solution would be to allow devs to expressly tell the file type with |
Ok! I was able to load tailwind in the demo project 🙌 |
Hi @pxpm i've created public/assets/js/tailwind-3.4.3.js then
to my config/backpack/theme-coreuiv2.php but i no have this tailwind-3.4.3.js globally in my blades Looking browser console i see: what's wrong ? |
Nothing wrong with Backpack. If you are seeing that in your console is because tailwind is being successfully loaded into the page, so you should be able to do tailwind stuff. Cheers |
@pxpm In reality it doesn't work for me, if in fact I remove this line from a blade: It doesn't work for me anymore... I tried to put @basset(public_path('assets/js/tailwind-3.4.3.js')) on my blade and works fine, so now i'd like to have it globally for all my blades.. How can i do that ? |
Hey @blondie63 I can't see the line you removed from blade, maybe you missed to post it. In your 'styles' => [
public_path('assets/js/tailwind-3.4.3.js'),
] If using a theme, eg. theme tabler, that change need to be done in Last try I tried to load tailwind with tabler it completely broke the panel, so for Backpack to work with tailwind I expect that you will need to customize quite a bit (A LOT) of files. Cheers |
I've used Tailwindcss because i'm just using it in other blades but my previous developer import it in each blade with:
Now i'd like to use basset to have last tailwind 3.4.3 version global and optimized Can you advise me how to do it?Originally posted by @blondie63 in Laravel-Backpack/community-forum#906 (reply in thread)
The text was updated successfully, but these errors were encountered: