Skip to content

Commit 1851b19

Browse files
committed
Merge pull request symfony#3247 from bicpi/update_minifier_recommendation
[Cookbook][Assetic] Update JS minifier recommendation
2 parents 4646159 + dddb396 commit 1851b19

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
@@ -265,7 +265,7 @@ To use a filter, you first need to specify it in the Assetic configuration.
265265
Adding a filter here doesn't mean it's being used - it just means that it's
266266
available to use (you'll use the filter below).
267267

268-
For example to use the JavaScript YUI Compressor the following config should
268+
For example to use the UglifyJS JavaScript minifier the following config should
269269
be added:
270270

271271
.. configuration-block::
@@ -275,25 +275,25 @@ be added:
275275
# app/config/config.yml
276276
assetic:
277277
filters:
278-
yui_js:
279-
jar: "%kernel.root_dir%/Resources/java/yuicompressor.jar"
278+
uglifyjs2:
279+
bin: /usr/local/bin/uglifyjs
280280
281281
.. code-block:: xml
282282
283283
<!-- app/config/config.xml -->
284284
<assetic:config>
285285
<assetic:filter
286-
name="yui_js"
287-
jar="%kernel.root_dir%/Resources/java/yuicompressor.jar" />
286+
name="uglifyjs2"
287+
bin="/usr/local/bin/uglifyjs" />
288288
</assetic:config>
289289
290290
.. code-block:: php
291291
292292
// app/config/config.php
293293
$container->loadFromExtension('assetic', array(
294294
'filters' => array(
295-
'yui_js' => array(
296-
'jar' => '%kernel.root_dir%/Resources/java/yuicompressor.jar',
295+
'uglifyjs2' => array(
296+
'bin' => '/usr/local/bin/uglifyjs',
297297
),
298298
),
299299
));
@@ -305,21 +305,21 @@ into your template:
305305

306306
.. code-block:: html+jinja
307307

308-
{% javascripts '@AcmeFooBundle/Resources/public/js/*' filter='yui_js' %}
308+
{% javascripts '@AcmeFooBundle/Resources/public/js/*' filter='uglifyjs2' %}
309309
<script src="{{ asset_url }}"></script>
310310
{% endjavascripts %}
311311
312312
.. code-block:: html+php
313313

314314
<?php foreach ($view['assetic']->javascripts(
315315
array('@AcmeFooBundle/Resources/public/js/*'),
316-
array('yui_js')
316+
array('uglifyjs2')
317317
) as $url): ?>
318318
<script src="<?php echo $view->escape($url) ?>"></script>
319319
<?php endforeach; ?>
320320
321321
A more detailed guide about configuring and using Assetic filters as well as
322-
details of Assetic's debug mode can be found in :doc:`/cookbook/assetic/yuicompressor`.
322+
details of Assetic's debug mode can be found in :doc:`/cookbook/assetic/uglifyjs`.
323323

324324
Controlling the URL used
325325
------------------------

0 commit comments

Comments
 (0)