TailwindCSS safelist is not working.
I've added a class
h-[60vh]
to the safelist in my custom theme, and I've also included the file path in the content section of the tailwind.config.js file. However, the class doesn't seem to be working as expected.
tailwind.config.js
export default {
darkMode: "class",
safelist: [
'h-[60vh]',
],
content: [
"./app/Filament/**/*.php",
"./app/Livewire/**/*.php",
"./resources/views/**/*.blade.php",
"./vendor/filament/**/*.blade.php",
],
};
10 Replies
I assume you run npm build again?
I attempted it multiple times—first with ‘npm run dev’ but no results were observed. After stopping the dev, I executed ‘npm run build’ yet the outcome remained unchanged.
I’m not totally sure that custom attributes will work in a safelist like that.
I verified that arbitrary values function properly in the safelist, as discussed in this GitHub thread: https://github.com/tailwindlabs/tailwindcss/discussions/7908
GitHub
Safelist pattern for arbitrary values · tailwindlabs tailwindcss · ...
What version of Tailwind CSS are you using? v. 3.0.23 I am trying to whitelist a set of arbitrary values since the classes is set within a CMS. I need to include top-0% to top-100% and left-0% to l...
You also created and configured a custom theme, right?
Yes, i did.
I believe I haven't misconfigured anything; here is the content of my
vite.config.js
file.
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/admin/theme.css"],
refresh: [
...refreshPaths,
"app/Filament/**",
"app/Forms/Components/**",
"app/Livewire/**",
"app/Infolists/Components/**",
"app/Providers/Filament/**",
"app/Tables/Columns/**",
],
}),
],
});
What's the file you added
h-[60vh]
to?
Can you share the PanelProvider config?File
PanelProvider
Can you try
"app/Livewire/**/*.php",
instead of "app/Livewire/**",
not sure whether that makes a difference thoughI tried but same result 😭
After days of debugging, I realized that I've been editing the wrong
tailwind.config.js
file. The correct file that needs to be edited is located at resources\css\filament\admin\tailwind.config.js
.