当我在布局中添加这样的行时.html.php:
<?php foreach ($view['assetic']->stylesheets(
array('@AnglerBackendBundle/Resources/public/css/*')
) as $url
): ?>
<link rel="stylesheet" href="<?= $view->escape($url) ?>" />
<?php endforeach ?>
配置:
# Assetic Configuration
assetic:
debug: %kernel.debug%
use_controller: false
# java: /usr/bin/java
filters:
cssrewrite: ~
# closure:
# jar: %kernel.root_dir%/java/compiler.jar
yui_css:
jar: %kernel.root_dir%/java/yuicompressor.jar
yui_js:
jar: %kernel.root_dir%/java/yuicompressor.jar
我看到 5 个标签与 5 个资源链接,但根据 Symfony 2 文档,我应该只看到一个文件。我做错了什么
只是为了把答案放在一个实际的答案中:
您需要更改此设置:$kernel = new AppKernel('prod', true);
对此:$kernel = new AppKernel('prod', false);
第二个参数是调试参数。 如果调试关闭,Assetic 只会写入一个文件。