Symfony2 - 子域上的资产背景图像

时间:2013-02-05 15:50:42

标签: css symfony assetic symfony-2.2

我在Symfony 2.2中有两个捆绑包

1。 domaint.tld上的FrontBundle

  • 使用domain.tld / symfony的/ SRC /北美经销商/ FrontBundle /资源/公共/ CSS
  • 使用domain.tld / symfony的/ SRC /北美经销商/ FrontBundle /资源/公共/图像
  • 使用domain.tld / symfony的/ SRC /北美经销商/ FrontBundle /资源/公共/ JS

2。 admin.undmain.tld上的AdminBundle

  • domain.tld / symfony / src / Comapny / AdminBundle / Resources / public / css(custom.css)
  • domain.tld / symfony / src / Comapny / AdminBundle / Resources / public / images(image.png)
  • 使用domain.tld / symfony的/ SRC /北美经销商/ AdminBundle /资源/公共/ JS

使用domain.tld / symfony的/ SRC /北美经销商/ AdminBundle /资源/公共/ CSS / custom.css

div.image {
    background-image: url(../images/image.png);
}

使用domain.tld / symfony的/应用/配置/ config.yml

debug:          "%kernel.debug%"
use_controller: false
bundles:        [ AdminBundle, FrontBundle ]
read_from:      "%kernel.root_dir%/../../public_html/"
write_to:      "%kernel.root_dir%/../../public_html/"
filters:
    cssrewrite: ~

使用domain.tld / symfony的/应用/配置/ routing.yml中

admin:
    host: "admin.domaint.tld"
    resource: "@AdminBundle/Controller/"
    type:     annotation

front: 
    host: "domain.tld"
    resource: "@FrontBundle/Controller/"
    type:     annotation

使用domain.tld / symfony的/ SRC /公司/ AdminBundle /资源/视图/ layout.html.twig

{% stylesheets
'bundles/admin/css/custom.css'
filter='cssrewrite,?yui_css'
 %}
<link rel="stylesheet" href="{{ asset_url }}"/>
{% endstylesheets %}

我用

app/console cache:clear
app/console assets:install ../public_html --symlink   
app/console assetic:dump

-

问题

在domain.tld上可以正常工作,但问题出在子域名上。

来自admin.domain.tld的

源代码

<link rel="stylesheet" href="/css/8d488cd_custom_11.css"/>

8d488cd_custom_11.css

div.image {
    background-image: url(../../bundles/admin/images/image.png);
}
来自萤火虫的

"NetworkError: 404 Not Found - http://admin.domain.tld/bundles/admin/images/image.png"

还知道如何纠正为子域和根域工作的(css背景)的代码或配置吗?

0 个答案:

没有答案
相关问题