Empty CSS when creating a new theme, not extending the default
was trying to create a new theme to overwrite just a few rules, followed all the instructions but I'm getting a basically empty CSS file
resources/css/filament/admin/theme.css:
That first link (theme.css) contains just this:
That one, if opened, contains this:
I did run build, but as soon as I add
->viteTheme('resources/css/filament/admin/theme.css')
to the AdminPanelProvider I'm getting the ugliest site ever
What am I missing?Solution:Jump to solution
try this postcss.config:
```
module.exports = {
plugins: {
tailwindcss: {},...
37 Replies
Check your dev tools (network tab). What does the file look like?
And what does your vite.config.js look like?
did you add
'resources/css/filament/admin/theme.css',
to vite.config.js file?
my final css, as received by the browser, is this:
that doesn't look good to me
That means it’s not compiling.
Nope. That one wasn't processed by VIte
Do you have a postcss.config.js file?
It should have been generated for you.
oh, I do, it's this:
That’s right.
i had to comment it out tho, cause it was throwing an error on build
show us your terminal output for npm run build
Tailwind won’t run without it.
[vite:css] Failed to load PostCSS config (searchPath: /home//domains//public_html): [SyntaxError] Unexpected token 'export'
Well, errors on build are a critical piece of information 😉
indeed, but it seemed an empty file, thought it was useless
6 lines aren't empty 😉
why you omit the most important info -> " cause it was throwing an error on build"
you ain't wrong indeed
I guess you need
.mjs
extension for postcss.config.Solution
try this postcss.config:
```
module.exports = {
plugins: {
tailwindcss: {},
autoprefixer: {},
},
}
yeah, i did quite a few things in a short period, forgot about it
this one compiled
or you can change postcss file extension to
mjs
with this
warn - The
content
option in your Tailwind CSS configuration is missing or empty.
warn - Configure your content sources or your generated CSS will be missing styles.
warn - https://tailwindcss.com/docs/content-configurationContent Configuration - Tailwind CSS
Configuring the content sources for your project.
but at least now the site displays properly
Ah ok, didn't know that xD
That error is coming from your app.css file most likely.
If you’re not using it you can remove it from your Vite config.
you are correct
thanks a lot you all
that could've been a messy morning
(all this because i was installing this plugin BTW: https://filamentphp.com/plugins/awcodes-overlook )
@awcodes i sure hope it's worth it! (jk, learning new stuff is always great)
You would have had to do it anyway. It’s the recommended way to style plugins with v3. So it would have been another plugin if it wasn’t one of mine.
Hope it serves your needs though. 🙂
right oout of the box it's not displaying properly it seems, but i'll look into it
If you don’t add the views to the content in your tailwind config and rebuild your theme then it’ll do that.
Please read the Readme.
forgot to rebuild, yep
i did add, but didn't npm run
i'm still new to the whole npm/css/whatever thingy, i'm a backend guy
No worries.
One question.. i know that this its resolved... but for the only thing that fix the problem was changing the resulting file from the new theme from. this:
Hope it helps