I am trying to use Assetic in a Symfony 2 project. I have the following settings in my config.yml:
assetic:
debug: %kernel.debug%
use_controller: true
filters:
cssrewrite: ~
yui_css:
jar: /home/testing/bin/yuicompressor-2.4.7.jar
less:
node: /usr/bin/node
node_paths: [/usr/local/bin/]
apply_to: "\.less$"
assets:
all_js:
inputs:
- @FoundationViewBundle/Resources/public/js/*
filters: [?yui_js]
all_css:
inputs:
- @FoundationViewBundle/Resources/public/css/*
filters: [less, ?yui_css]
(If you are interested, these parameters are not overridden in the config_dev.yml file.)
These collections are collected by Assetic and routes are created for them. For each file there are individual routes with a number and a file name without a file extension. For example, for the file "base.css", the route to download the file (using filters) is "/ assetic / all_css_part_1_base_1".
Then I include the asset collection in my Twig template as follows:
{% stylesheets '@all_css' %}
<link rel="stylesheet" type="text/css" media="screen" href="{{ asset_url }}">
{% endstylesheets %}
(And similarly for the "all_js" collection, but I will use the css side to demonstrate my problem.)
Twig , , , "asset_url" "all_css" "/css/9118a5a_part_1.css".
front front controller , Assetic , . (, , .) , , .
, , JavaScript. - , , Twig ?