I make a tesla clone with html and taiwind css.It work fine on my live server, but image doesnot show while while deploying it to github page.
The project is given below:
https://github.com/Manikkk3/Tesla-clone-repository
I try changing (./images/…) and (/images/..) but it doesnot work on tailwind.config.js
I try changing (./images/…) and (/images/..) but it doesnot work on tailwind.config.js
I want to display background image.
2
Answers
Try to use a direct URL path for your images in tailwind.config.js file
I am not sure if you have found a solution for this problem yet. I recently faced the same problem and after a lot of searching around I found the solution for this in the link. So I am adding the answer here for anyone who might face a similar problem.
Basically we need to add the path for
url
relative to the css file (after it is generated). Not relative to thetailwind.config.js
file.So if the css file is in the build directory like
build/css/main.css
and images are like so:build/images/model-3.jpg
then the path in url would be:"url('../images/model-3.jpg')"
And the
tailwind.config.js
file would be: