Symfony2 - Assetic - load images in CSS

后端 未结 9 2087
逝去的感伤
逝去的感伤 2020-11-29 17:38

I have a CoreBundle that contains main css files and images. Now I have a problem when I load an image from css; the image isn\'t shown.

 background-image:ur         


        
9条回答
  •  抹茶落季
    2020-11-29 18:07

    use the cssrewrite filter from Assetic bundle

    In config.yml:

    assetic:
        debug:          %kernel.debug%
        use_controller: false
        filters:
            cssrewrite: ~
    

    And then call your stylesheets like this:

     {% stylesheets 'bundles/cmtcore/css/*' filter='cssrewrite' %}
            
     {% endstylesheets %}
    

    Oh and don't forget to use php app/console assetic:dump

提交回复
热议问题