Are you running npm run dev?
Tailwind Classes don't get compiled
I have a Laravel 10, Livewire 3 project that uses Tailwind. I have this piece of code which generates dynamic tables and items in it:
$this->createAction("", 'link-base bg-main-gray cursor-not-allowed rounded-tr-lg text-danger', '<svg viewBox="0 0 24 24" fill="currentColor" class="size-6 fill-main-gold">...</svg>'),
and then in the frontend the code generates like so:
<button type="button" onclick="window.open('', '_blank')" class="py-2 px-2 link-base bg-main-gray cursor-not-allowed rounded-tr-lg text-danger"><svg viewBox="0 0 24 24" fill="currentColor" class="size-6 fill-main-gold">...</svg></button>
I head to the Chrome inspector, and I see that I have all the Tailwind classes working except the ones regarding the rounded borders and the cursor-not-allowed. The rest are there and working, with the styling I gave it, the bg-main-gray shows up, the size-6 shows up, the fill-gold... as well. I added rounded-lg instead of rounded-tr-lg in createAction() and this one, of course, works fine and without a problem, because why would I expect it to be otherwise? So, how come rounded-lg would work but not rounded tr lg, its jt confusing and frustrating. Whats weird is that they worked before when I had static tables, but I completely restructured the tables only so that they are generated dynamically and I switched a couple of routing parameters, but nothing major.
I ran npm run build numerous times, cleared all cache types and stuff like that, it just doesnt want to work and Im not sure what it could be. My tailwind.config.js:
import defaultTheme from 'tailwindcss/defaultTheme';
import forms from '@tailwindcss/forms';
import typography from '@tailwindcss/typography';
/** @type {import('tailwindcss').Config} */
export default {
content: [
'./vendor/laravel/framework/src/Illuminate/Pagination/resources/views/*.blade.php',
'./vendor/laravel/jetstream/**/*.blade.php',
'./storage/framework/views/*.php',
'./resources/views/**/*.blade.php',
'./resources/views/*.blade.php',
],
theme: {
extend: {
colors: {
'main-gold': '#cfa200',
'main-gold-hover': '#d1b345',
'pure-gold': '#FFD700',
'highlight-gold': '#FFF0A0',
'danger': '#DC2626',
'danger-hover': '#F87171',
'main-gray': '#e5e7eb', /* gray-200 */
'darker-gray': '#4b5563',/* gray-600 */
'main-text': '#1f2937', /* gray-800 */
'faded-text': '#717A71', /* gray-500 */
},
fontFamily: {
sans: ['Figtree', ...defaultTheme.fontFamily.sans],
},
maxHeight: {
'128': '32rem'
},
},
screens: {
'phone': '640px', /*Portrait Tablets, Large Phones*/
'tablet': '768px', /*Landscape Tablets*/
'laptop': '1024px', /*Older Laptops*/
'desktop': '1280px',/*Older Desktops*/
'hd': '1536px', /*HD*/
'fhd': '1920px', /*Full-HD*/
'qhd': '2560px', /*Quad-HD*/
}
},
plugins: [forms, typography],
};
My table component view file is located in: resources/views/components/action-table.blade.php, while the table is being used in resources/views/livewire/listing/index.blade.php as a component. I just want to pinpoint the issue, but I cant seem to, how can I find out whats causing the issue?
@bvfi-dev That is probably the problem, tailwind doesn't know about those classes.
I'm guessing you are using the default Tailwind config file?
/** @type {import('tailwindcss').Config} */
export default {
content: [
"./resources/**/*.blade.php",
"./resources/**/*.js",
"./resources/**/*.vue",
],
theme: {
extend: {
},
},
plugins: [],
}
If so it only looks for classes in js, vue and blade files. You could probaby add your livewire classes to the list of content.
Please or to participate in this conversation.
Basically Tailwind gets yeeted