Missing image from stylesheet in production

Hello Guys,

I have a funny issue going on. So i have ran yarn build:production. everything is working fine on the local dev site which I have up and running which is on trellis/vagrant

Looking at the source code I can see all files now referenced with hashes.

I uploaded to the server and I have an issue.

It relates to the logo in the header. I am using css to display the logo which is:

.brand {
    background-image: url(/app/themes/MYTHEME/dist/images/Logo_d5e67882.svg);
    background-repeat: no-repeat;
    background-size: auto auto;
    background-size: contain;
    display: block;
    float: left;
    height: 60px;
    text-indent: -9999px;
    width: 250px;}

This is exactly the same on the dev site and it shows the logo. however, on the production site, it doesn’t show and I get the message that ‘image could not be loaded’ when inspecting the element!

I have set the image in the header as indicated by the docs:

.background {
  background-image: url(../images/image.jpg);

I have ran yarn build:production a few times but its the same result. it doesn’t show the image: image could not be loaded.

When I try to view the image in new browser window its the same result. I get a 404 not found.

I then moved the image to the root of the site and changed the location in the inspector to call the image from root and it works. I can also view the image in a new tab with no issues.

Seems like it’s not having it from the theme or theme css…

can anyone shed some light on why this is happening?

FYI its a a new WP build with the following .htacces file:

<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteRule ^index\.php$ - [L]
#RewriteRule ^plugins/(.*) /app/plugins/$1 [QSA,L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]

also not sure if this line still needs to stay in as it was part of an old roots theme inclusion:

#RewriteRule ^plugins/(.*) /app/plugins/$1 [QSA,L]

i have commented it out for time being not sure if it needs to stay in or not!

after investigating further it seems that certain svg images are being outputted ok. I have a ‘go to top’ svg image that displays correctly on both production and dev builds which is also refernced in my css file as is the logo.svg.

the logo image just doesn’t want to display on production. I can not seem to figure it out.

I added some images to my page vis WordPress editor and again ran yarn:build production and again on the dev install it shows fine but on the production it doesn’t.

FYI all the images are svg. is there something that is preventing my svg images from being shown on production? i ran into no errors on yarn build:production…

I have this issue too, did you have already know how to fix it? i’m still cannot fix it.

Are these SVG images inlined by postcss and something went wrong?