Skip to content
Advertisement

Tailwindcss background image not showing on deploy

Both the background image and navbar background don’t render. I’m using Vercel and Netlify to deploy and have used the build command as well as the publish directory setup on both sites. Tried checking my code since I’m using Tailwind for the first time, but I still can’t figure out what went wrong?

The repo: https://github.com/d4nky/Tailwindcss-Portfolio
The site: https://inspiring-carson-2c8f1d.netlify.app

Any piece of information would be appreciated 🙂

Advertisement

Answer

You have to put img directory in your dist too, because for now, you are using path /img/background.jpg which refers to repo /dist/img/background.jpg file, that doesn’t exist.

You can check that in the console, which says:

GET https://inspiring-carson-2c8f1d.netlify.app/img/background.jpg [HTTP/1.1 404 Not Found]

And the same for logo_size.jpg.

You could put those directories directly to dist directory by hand, or use some bundling tool like webpack to automate things.

User contributions licensed under: CC BY-SA
6 People found this is helpful
Advertisement