Assetic css images have disappeared
-
07-07-2021 - |
Question
I have this image: Symfony/web/bundles/BackendBundle/images/main.png
I enable yui compresor for this style: Symfony/web/bundles/BackendBundle/images/main.css, it orks fine.
I have this in config.yml: cssrewrite: ~
But images of main.css does not work, why?
I try this different formats:
background-image: url(/bundles/BackendBundle/images/main.png);
background-image: url(bundles/BackendBundle/images/main.png);
background-image: url(../images/main.png);
Solution 2
I have found the solution, I reply my question: {% stylesheets "bundles/BackendBundle/css/*" filter="cssrewrite, yui_css" %} I put cssrewrite in assetic declaration and relative path works
OTHER TIPS
The CSS File is in the same directory as the images, you would simply call:
background-image: url('main.png');
Also, you didn't list above that "main_bg2.png" is uploaded, only main.png. You may be missing the files you are trying to call with CSS - upload them if you haven't. Sometimes with multiple extensions of the same file name, things get confusing.