I want to add a background image to my meteor webapp:
background: url('../public/img/car.jpg') no-repeat center center fixed;
But then I get the following error message:
jquery.js?hash=c334cf5…:3662 Not allowed to load local resource: file:///D:/project/app/public/car.jpg
What am I missing?
I think you might be misunderstanding the use of the public
folder (see the doc on directory structure ). Anything in that folder will be served statically on the /
URL. So I think all you need to change is this:
background: url('/img/car.jpg') no-repeat center center fixed;
I finally found the answer here: meteor app: images not loading
Files in /public are served to the client as-is
So I had to exclude the file path and just type /car.png
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.