1
當我在layout.html.php添加這樣的臺詞:Symfony 2資產。不要看到單一的CSS或JS文件
<?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文檔我應該只看到一個文件。 我沒有什麼錯
prod或dev模式?或兩者? – 2012-04-28 21:50:16
你在開發環境中測試它嗎?如果是這樣,這是正常的行爲。 http://symfony.com/doc/current/cookbook/assetic/asset_management.html:「在開發環境中,每個文件仍然是單獨提供的,這樣您就可以更容易地調試問題。但是,在產品環境中,這將呈現爲單個腳本標記。「 – dbrumann 2012-04-28 21:50:49
在這兩種環境中都如此。 – setty 2012-04-29 09:29:17