I am using create-react-app
to develop my react app and deploy it to Github pages. My app works correctly on development. But when I deploy, it successfully deploys but the background image failed to load.
loading background image in a index.css
file:
body::after {
background-image: url("/background-img.jpg");
}
The homepage on package.json
{
"homepage": "http://bigfanjs.github.io/my-repo/",
}
Background image on app directory:
| build
| background-img.jpg
| src
| public
| background-img.jpg
And on the console:
Finally when I edit the URL on developer tools to url(/my-repo/background-img.jpg)
it loads.
body::after { background-image: url("background-img.jpg"); }
ie without/
– Indefensiblesrc/
whereindex.css
is located. thanks – Groos