我刚刚安装了SonataAdminBundle,我发现SonataAdminBundle已经安装了fontawesome和另一个css / js资产安装在公共文件夹中,我的问题是如何在我自己的Bundle中重用那些js / css资产?这是我的代码:
{% block stylesheets %}
{% stylesheets
'@SonataAdminBundle/Resources/public/vendor/bootstrap/dist/css/bootstrap.min.css'
'@SonataAdminBundle/Resources/public/vendor/bootstrap/dist/css/bootstrap-theme.min.css'
'@ApplicationSonataUserBundle/Resources/public/css/signin.css'
'@SonataAdminBundle/Resources/public/vendor/AdminLTE/css/font-awesome.min.css'
filter='cssrewrite'
filter='yui_css'
%}
<link rel="stylesheet" type="text/css" href="{{ asset_url }}">
{% endstylesheets %}
{% endblock %}
但遗憾的是所有字体都是404状态?这意味着我们不能再使用来自其他供应商包的所有js / css吗?
答案 0 :(得分:0)
我刚刚找到答案,这里是: 跑
./app/console assets:install web
它将在web /文件夹中创建所有捆绑资产,然后我将我的代码更改为:
{% block stylesheets %}
{% stylesheets
'bundles/sonataadmin/vendor/bootstrap/dist/css/bootstrap.min.css'
'bundles/sonataadmin/vendor/bootstrap/dist/css/bootstrap-theme.min.css'
'@ApplicationSonataUserBundle/Resources/public/css/signin.css'
'bundles/sonataadmin/vendor/AdminLTE/css/font-awesome.min.css'
filter='cssrewrite'
filter='yui_css'
%}
<link rel="stylesheet" type="text/css" href="{{ asset_url }}">
{% endstylesheets %}
然后我跑
./app/console assetic:dump
现在一切正常,所有精彩的图标都显示