首页 文章

Assetic重写会在其中创建错误的“Resources / public”路径

提问于
浏览
0

我添加了一个使用资产的样式表......

{% stylesheets
    '@MyBundle/Resources/public/iCheck/all.css'
    filter='cssrewrite'
%}
<link rel="stylesheet" href="{{ asset_url }}" />
{% endstylesheets %}

all.css包含几个包含...

@import url("minimal/_all.css");
@import url("square/_all.css");
...

当我传递页面时,css文件作为 http://localhost/app_dev.php/css/d764ee6_all_4.css 传递,但它的路径被重写为:

@import url("../../Resources/public/iCheck/minimal/_all.css");
@import url("../../Resources/public/iCheck/square/_all.css");
...

我想“../../Resources/public/”不应该在那里 . 对?但是我能做些什么呢?

Directory structure 这些文件位于 MyBundle/Resources/public/ . /Resources/public/iCheck/all.css 包括 /Resources/public/iCheck/minimal/_all.css .

My Assetic configuration:

assetic:
    debug:          "%kernel.debug%"
    use_controller: true
    bundles:
        - MyBundle
    filters:
        cssrewrite: ~

1 回答

  • 0

    如果您使用的是cssrewrite过滤器,则不应使用 @... 快捷方式表示法 . 请改用路径表示法(绝对/相对路径) .

相关问题