Force base directory for images
Hi,
I have a few css-files that are included inline once the application is running. The css-file could be located relative from the root at, say templates/css/example.css
The css then contains something like:
.sports-list-ul li img {
background: url(images/spritesSports.png) no-repeat;
}
WebStorm gives me an error on this, saying it can't find the resource. Can I override this check with a static path to resources, or worse, just remove the check at all?
Please sign in to leave a comment.
Hi Robin,
Please mark parent folder of "images" as Resource Root ("Settings | Directories" ... or similar via right click menu in Project View panel).
P.S.
Yes, you can turn off that inspection: Settings | Inspections | CSS | Unknown file or directory
Hmm, parent directory as Resource Root doesn't do the trick I'm afraid. Disabling the check works though :)
Works fine for me (for over 2 years now).
P.S.
But maybe -- maybe it is because I have such URLs/links relative to the site root and not the current file (link to resource starts with / , e.g. "/images/logo.png").
P.P.S.
Nope -- works fine in both cases. Maybe you need to refresh project indexes/caches (File | Invalidate Caches) ?
Thanks was probably it, seems to work now, thank you once again :)