F
Filament3mo ago
rudy

Styles don't work with third party on publish, works just fine on local machine

I'm having a custom page that loads JS file and using vis-timeline third party library, custom styles works just fine on local machine but they're not applied when I publish it to the server.
No description
6 Replies
LeandroFerreira
LeandroFerreira3mo ago
console errors?
rudy
rudy3mo ago
None
christmex
christmex3mo ago
somehow, the git .ignore the public files, do u have npm on ur server? try to npm install, or if u dont have it, then npm run dev from ur local, and make sure there is no /public in .gitignore, if u're using git ofc
rudy
rudy3mo ago
ah, you guide me to the right direction, somehow when I only build npm build the styles don't get loaded, but when I npm run dev it's running properly
christmex
christmex3mo ago
But, if it's on production u need to run nom run build to compile the asset
rudy
rudy3mo ago
I did run it, it's still not loading when I only build them, both in dev and in prod, it's loading properly when I'm running dev though found the solution, turns out either vite or blade or laravel (not sure), doesn't allow you to combine the custom js file and the styling in one directive CMMIW, after creating a "placeholder" which is just an empty js file, and importing that directive as a couple with the css file, it worked as intended, here's what I did to fix it, to illustrate my phrasing better:
@vite('resources/js/filament/timeline.js')
@vite(['resources/css/timestyle.css', 'resources/js/timestyle.js'])
@vite('resources/js/filament/timeline.js')
@vite(['resources/css/timestyle.css', 'resources/js/timestyle.js'])
thanks guys 🙂