I have a CSS code snippet that looks like this:
.is--stratus .icon__nav-threats.is--gray {
background: url('/resources/img/navIcons_RiskInsight.png') no-repeat -1px -41px;
width: 30px;
height: 30px;
}
.is--stratus .icon__nav-threats.is--blue {
background: url('/resources/img/navIcons_RiskInsight.png') no-repeat -1px -83px;
width: 30px;
height: 30px;
}
Upon changing the class name from is--gray to is--blue for the element, a new request is made for the same file. This results in the background image loading after a couple of seconds, giving the appearance of a broken UI.
I am trying to understand why this is happening. Could it be related to how we are loading CSS into the page? I am using webpack1 and this issue only seems to occur in the production build, not the development build. Could it be possible that browsers do not cache images loaded through JavaScript-injected CSS?