tailwind css classes not working in custom theme

I'm asking this here because I don't think it's a purely tailwindcss issue. I think it's related to custom themes. I'm trying to use bg-slate-100, but no matter what I do, I can't get it to show up in my rendered view. I did the following: 1) I created the custom theme 2) I added the file I need to get the styles from to the content array in the tailwind.config.js file. 3) I ran npm run build. 4) I'm referencing the css file like so in my layout file (separate layout file from the main one): <link href="{{ asset('css/filament/filament/app.css') }}" rel="stylesheet" /> 5) I also added the colors plugin to the tailwind.config.js file, but I'm not sure that was necessary. I can dd the view and see that the class is in the markup, but it's not rendering. There are a couple of other styles that seem to not be rendering, but it doesn't seem like it's all the styles. Here's my tailwind.config.js file:
import preset from '../../../../vendor/filament/filament/tailwind.config.preset'
const colors = require('tailwindcss/colors')

export default {
presets: [preset],
content: [
'./app/Filament/Admin/**/*.php',
'./resources/views/pdf/*.blade.php', <---this is the file with needed css.
'./resources/views/filament/admin/**/*.blade.php',
'./resources/views/filament/app/resources/**/**/*.blade.php',
'./vendor/filament/**/*.blade.php',
],
theme: {
extend: {
colors: {
...colors,
}
}
}
}
import preset from '../../../../vendor/filament/filament/tailwind.config.preset'
const colors = require('tailwindcss/colors')

export default {
presets: [preset],
content: [
'./app/Filament/Admin/**/*.php',
'./resources/views/pdf/*.blade.php', <---this is the file with needed css.
'./resources/views/filament/admin/**/*.blade.php',
'./resources/views/filament/app/resources/**/**/*.blade.php',
'./vendor/filament/**/*.blade.php',
],
theme: {
extend: {
colors: {
...colors,
}
}
}
}
The page that I want to use the CSS file on is outside of the normal filament tenant, but I'm thinking it should still work the same way if I'm referencing the CSS file. I can't find the value #f1f5f9 in the compiled css file either, which is the slate-100 color.
No description
Solution:
Also you should use @vite instead of <link href="asset(">
Jump to solution
3 Replies
Dennis Koch
Dennis Koch14mo ago
Can you share your vite.config.js? Or how do you compile your file?
Solution
Dennis Koch
Dennis Koch14mo ago
Also you should use @vite instead of <link href="asset(">
Jon Mason
Jon MasonOP14mo ago
import { defineConfig } from 'vite'
import laravel, { refreshPaths } from 'laravel-vite-plugin'

export default defineConfig({
plugins: [
laravel({
input: ['resources/css/app.css', 'resources/js/app.js', 'resources/css/filament/app/theme.css'],
refresh: [
...refreshPaths,
'app/Filament/**',
'app/Forms/Components/**',
'app/Livewire/**',
'app/Infolists/Components/**',
'app/Providers/Filament/**',
'app/Tables/Columns/**',
],
}),
],
})
import { defineConfig } from 'vite'
import laravel, { refreshPaths } from 'laravel-vite-plugin'

export default defineConfig({
plugins: [
laravel({
input: ['resources/css/app.css', 'resources/js/app.js', 'resources/css/filament/app/theme.css'],
refresh: [
...refreshPaths,
'app/Filament/**',
'app/Forms/Components/**',
'app/Livewire/**',
'app/Infolists/Components/**',
'app/Providers/Filament/**',
'app/Tables/Columns/**',
],
}),
],
})
ahh ok. This is my first project with both vite and tailwind, so I'm probably doing all kinds of things wrong. using @vite fixed it. 🙄
Want results from more Discord servers?
Add your server