Symfony2 - assetic assetic:dump 命令无法正确创建样式表


symfony2 - the assetic assetic:dump command doesn't create stylesheets correctly

由于某种原因,我无法加载css文件。这是我使用的捆绑包的结构

BD
 WebsiteBundle
   public
     css

这是我尝试加载 css 文件的方式

{% stylesheets 'bundles/bdwebsite/css/*' filter='cssrewrite' %}
    <link rel="stylesheet" href="{{ asset_url }}" />
{% endstylesheets %}

我做了assetic:dump

我做错了什么?

您在stylesheets标签中提到了bundles/bdwebsite/css/*

这样,assetic 会查找 web/bundles/bdwebsite/css(当前不存在的文件夹)中的所有 css 文件,而不是在 src/BD/WebsiteBundle/public/css 中查找。

为了在执行assetic:dump之前将您的文件放在正确的位置...

。使用app/console assets:install web将它们复制到 Web 文件夹...

。或者我推荐app/console assets:install web --symlink符号链接。