我使用 assetic 添加了一个样式表 ...
{% 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/”不应该在那里。正确的? 但是我能做些什么呢?
目录结构
这些文件位于 MyBundle/Resources/public/
中。
/Resources/public/iCheck/all.css
包括
/Resources/public/iCheck/minimal/_all.css
.
我的 Assets 配置:
assetic:
debug: "%kernel.debug%"
use_controller: true
bundles:
- MyBundle
filters:
cssrewrite: ~
最佳答案
如果您正在使用 cssrewrite 过滤器,则不应使用 @...
快捷符号。请改用路径表示法(绝对/相对路径)。
关于css - Assets 重写创建了错误的路径,其中包含 "Resources/public",我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/34110486/