Skip to content

Commit bc6ffbe

Browse files
committed
Rewords and code improvements
1 parent 3ea9c86 commit bc6ffbe

File tree

1 file changed

+37
-11
lines changed

1 file changed

+37
-11
lines changed

cookbook/frontend/assetic_php.rst

+37-11
Original file line numberDiff line numberDiff line change
@@ -36,10 +36,10 @@ directory and execute the following commands:
3636
It's very important to maintain the ``~1.0`` version constraint for the ``jsqueeze``
3737
dependency because the most recent stable version is not compatible with Assetic.
3838

39-
Organizing Your Web Asset Files
39+
Organizing your Web Asset Files
4040
-------------------------------
4141

42-
This example shows the very common scenario of using the Bootstrap framework, the
42+
This example shows the common scenario of using the Bootstrap framework, the
4343
jQuery library, the FontAwesome icon fonts and some regular CSS and JavaScript
4444
application files (called ``main.css`` and ``main.js``). The recommended directory
4545
structure for this set-up is the following:
@@ -95,6 +95,7 @@ defined by Assetic:
9595

9696
.. code-block:: html+jinja
9797

98+
{# app/Resources/views/base.html.twig #}
9899
<!DOCTYPE html>
99100
<html>
100101
<head>
@@ -108,22 +109,47 @@ defined by Assetic:
108109
<link rel="stylesheet" href="{{ asset_url }}" />
109110
{% endstylesheets %}
110111
111-
This simple configuration compiles the SCSS files into regular CSS files, combines
112-
all of them, minimizes the contents and saves the output in the ``web/css/app.css``
113-
file, which is the one that is served to your visitors.
112+
This simple configuration compiles, combines and minifies the SCSS files into a
113+
regular CSS file that's put in ``web/css/app.css``. This is the only CSS file
114+
which will be served to your visitors.
114115

115116
Combining and Minimizing JavaScript Files
116117
-----------------------------------------
117118

118119
First, configure a new ``jsqueeze`` Assetic filter as follows:
119120

120-
.. code-block:: yaml
121+
.. configuration-block::
121122

122-
# app/config/config.yml
123-
assetic:
124-
filters:
125-
jsqueeze: ~
126-
# ...
123+
.. code-block:: yaml
124+
125+
# app/config/config.yml
126+
assetic:
127+
filters:
128+
jsqueeze: ~
129+
# ...
130+
131+
.. code-block:: xml
132+
133+
<!-- app/config/config.xml -->
134+
<?xml version="1.0" charset="UTF-8" ?>
135+
<container xmlns="http://symfony.com/schema/dic/services"
136+
xmlns:assetic="http://symfony.com/schema/dic/assetic">
137+
138+
<assetic:config>
139+
<filter name="jsqueeze" />
140+
<!-- ... -->
141+
</assetic:config>
142+
</container>
143+
144+
.. code-block:: php
145+
146+
// app/config/config.php
147+
$container->loadFromExtension('assetic', array(
148+
'filters' => array(
149+
'jsqueeze' => null,
150+
// ...
151+
),
152+
));
127153
128154
Then, update the code of your Twig template to add the ``{% javascripts %}`` tag
129155
defined by Assetic:

0 commit comments

Comments
 (0)