简体   繁体   English

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

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

For some reason I can't load the css files. 由于某种原因,我无法加载css文件。 Here is the structure of the bundle that I use 这是我使用的包的结构

BD
 WebsiteBundle
   public
     css

And here is how I try to load the css files 以下是我尝试加载css文件的方法

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

I did assetic:dump 我做了assetic:dump

What I'm doing wrong? 我做错了什么?

You referred to bundles/bdwebsite/css/* in your stylesheets tag. 您在stylesheets标记中引用了bundles/bdwebsite/css/*

This way assetic looks for all css files in web/bundles/bdwebsite/css (a folder that currently does not exist) and not in src/BD/WebsiteBundle/public/css . 这样资产可以查找web/bundles/bdwebsite/css (当前不存在的文件夹)中的所有css文件,而不是src/BD/WebsiteBundle/public/css

In order to have your files in the right place before executing assetic:dump ... 为了执行assetic:dump 之前将文件放在正确的位置assetic:dump ...

... use app/console assets:install web which will copy them to the web folder... ...使用app/console assets:install web ,将它们复制到web文件夹...

... or my recommendation app/console assets:install web --symlink for symlinks. ...或我的推荐app/console assets:install web --symlink for symlinks。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM