Images in CSS Asset in Symfony2 -
i have next problem:
i included css file fancybox base.html.twig file:
{% block head_style %} {% stylesheets '../vendor/twbs/bootstrap/dist/css/bootstrap.min.css' filter='cssrewrite' '@bundle/resources/public/css/site.css' filter='cssrewrite' '@bundle/resources/public/css/jquery.fancybox.css' filter='cssrewrite' %} <link rel="stylesheet" type="text/css" href="{{ asset_url }}" /> {% endstylesheets %} {% endblock head_style %} my directory following:
the problem i'm fancing fancybox can't find fancybox_sprite.png,fancybox_overlay.png , fancybox_loading.gif.
here's 1 of paths in jquery.fancybox.css:
#fancybox-loading, .fancybox-close, .fancybox-prev span, .fancybox-next span { background-image: url('../images/fancybox_sprite.png'); }
here's path browser looking for:
http://project/resources/public/images/fancybox_sprite.png
what found out /images directory won't loaded /web dir, in /bundles dir, though used assets:install, assets:install --symlink , assetic:dump.
why can't scheme read images or why aren't images loaded /web dir?
i found few questions on this, neither of them helped me.
do not utilize @bundle notation cssrewrite, known fail -- read sec notice here.
you should instead write relative path css files web folder. 1 time have exported assets using bin/console assetic:install, new base.html.twig should read:
{% block head_style %} {% stylesheets '../vendor/twbs/bootstrap/dist/css/bootstrap.min.css' filter='cssrewrite' 'bundles/something_online/css/site.css' filter='cssrewrite' 'bundles/something_online/css/jquery.fancybox.css' filter='cssrewrite' %} <link rel="stylesheet" type="text/css" href="{{ asset_url }}" /> {% endstylesheets %} {% endblock head_style %} css symfony2 twig assets
No comments:
Post a Comment