Skip to content

Commit dddb396

Browse files
committed
[Cookbook][Assetic] Update JS minifier recommendation
1 parent 3ea60c0 commit dddb396

File tree

1 file changed

+10
-10
lines changed

1 file changed

+10
-10
lines changed

cookbook/assetic/asset_management.rst

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -238,7 +238,7 @@ To use a filter, you first need to specify it in the Assetic configuration.
238238
Adding a filter here doesn't mean it's being used - it just means that it's
239239
available to use (you'll use the filter below).
240240

241-
For example to use the JavaScript YUI Compressor the following config should
241+
For example to use the UglifyJS JavaScript minifier the following config should
242242
be added:
243243

244244
.. configuration-block::
@@ -248,25 +248,25 @@ be added:
248248
# app/config/config.yml
249249
assetic:
250250
filters:
251-
yui_js:
252-
jar: "%kernel.root_dir%/Resources/java/yuicompressor.jar"
251+
uglifyjs2:
252+
bin: /usr/local/bin/uglifyjs
253253
254254
.. code-block:: xml
255255
256256
<!-- app/config/config.xml -->
257257
<assetic:config>
258258
<assetic:filter
259-
name="yui_js"
260-
jar="%kernel.root_dir%/Resources/java/yuicompressor.jar" />
259+
name="uglifyjs2"
260+
bin="/usr/local/bin/uglifyjs" />
261261
</assetic:config>
262262
263263
.. code-block:: php
264264
265265
// app/config/config.php
266266
$container->loadFromExtension('assetic', array(
267267
'filters' => array(
268-
'yui_js' => array(
269-
'jar' => '%kernel.root_dir%/Resources/java/yuicompressor.jar',
268+
'uglifyjs2' => array(
269+
'bin' => '/usr/local/bin/uglifyjs',
270270
),
271271
),
272272
));
@@ -278,21 +278,21 @@ into your template:
278278

279279
.. code-block:: html+jinja
280280

281-
{% javascripts '@AcmeFooBundle/Resources/public/js/*' filter='yui_js' %}
281+
{% javascripts '@AcmeFooBundle/Resources/public/js/*' filter='uglifyjs2' %}
282282
<script src="{{ asset_url }}"></script>
283283
{% endjavascripts %}
284284
285285
.. code-block:: html+php
286286

287287
<?php foreach ($view['assetic']->javascripts(
288288
array('@AcmeFooBundle/Resources/public/js/*'),
289-
array('yui_js')
289+
array('uglifyjs2')
290290
) as $url): ?>
291291
<script src="<?php echo $view->escape($url) ?>"></script>
292292
<?php endforeach; ?>
293293
294294
A more detailed guide about configuring and using Assetic filters as well as
295-
details of Assetic's debug mode can be found in :doc:`/cookbook/assetic/yuicompressor`.
295+
details of Assetic's debug mode can be found in :doc:`/cookbook/assetic/uglifyjs`.
296296

297297
Controlling the URL used
298298
------------------------

0 commit comments

Comments
 (0)