我尝试使用Assetic将css和scss文件合并为一个,但是在编译过程中出现了错误。当我在控制台中输入时:php app / console assetic:dump
我的代码:
{% stylesheets
"@PortalSlubnyMainBundle/Resources/public/scss/main.scss" filter="compass"
"@PortalSlubnyMainBundle/Resources/public/css/*"
%}
<link rel="stylesheet" href="{{ asset_url }}" />
{% endstylesheets %}
最佳答案
确定,我找到了解决方案。
1.首先将jquery-ui-1.10.3.custom.min.css重命名为jquery-ui-1.10.3.custom.min.scss
2.其次,由于与CSS的scss兼容性,我可以在模板文件中执行以下操作:
{% stylesheets filter='?uglifycss' filter="cssrewrite" filter="compass"
"@PortalSlubnyMainBundle/Resources/public/scss/settings.scss"
%}
<link rel="stylesheet" href="{{ asset_url }}" />
{% endstylesheets %}
settings.scss
/* foundation files */
@import "foundation";
/* compass specific files */
@import "compass/css3/images";
/* portalslubny variables files - must be imported before scss files */
@import "variables.scss";
/* other css files converted to scss */
@import "jquery-ui-1.10.3.custom.min";
/* portalslubny scss files */
@import "main.scss";
@import "header.scss";
@import "footer.scss";
关于css - Assetic如何合并CSS和CSS文件,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/17630216/