Skip to content

Commit

Permalink
Update asset_management.rst
Browse files Browse the repository at this point in the history
| Q             | A
| ------------- | ---
| Doc fix?      | yes
| New docs?     | no
| Applies to    | 2.3
| Fixed tickets |
  • Loading branch information
ifdattic authored and wouterj committed Jan 17, 2015
1 parent 8d9a47c commit ff9f315
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions cookbook/assetic/asset_management.rst
Original file line number Diff line number Diff line change
Expand Up @@ -18,11 +18,11 @@ directly:

.. code-block:: html+jinja

<script src="{{ asset('js/script.js') }}" type="text/javascript"></script>
<script src="{{ asset('js/script.js') }}"></script>

.. code-block:: php
<script src="<?php echo $view['assets']->getUrl('js/script.js') ?>" type="text/javascript"></script>
<script src="<?php echo $view['assets']->getUrl('js/script.js') ?>"></script>
But *with* Assetic, you can manipulate these assets however you want (or
load them from anywhere) before serving them. This means you can:
Expand Down Expand Up @@ -60,15 +60,15 @@ To include JavaScript files, use the ``javascripts`` tag in any template:
.. code-block:: html+jinja

{% javascripts '@AppBundle/Resources/public/js/*' %}
<script type="text/javascript" src="{{ asset_url }}"></script>
<script src="{{ asset_url }}"></script>
{% endjavascripts %}
.. code-block:: html+php

<?php foreach ($view['assetic']->javascripts(
array('@AppBundle/Resources/public/js/*')
) as $url): ?>
<script type="text/javascript" src="<?php echo $view->escape($url) ?>"></script>
<script src="<?php echo $view->escape($url) ?>"></script>
<?php endforeach ?>
.. note::
Expand All @@ -82,7 +82,7 @@ To include JavaScript files, use the ``javascripts`` tag in any template:
{# ... #}
{% block javascripts %}
{% javascripts '@AppBundle/Resources/public/js/*' %}
<script type="text/javascript" src="{{ asset_url }}"></script>
<script src="{{ asset_url }}"></script>
{% endjavascripts %}
{% endblock %}
{# ... #}
Expand Down Expand Up @@ -548,7 +548,7 @@ command will automatically regenerate assets *as they change*:
$ php app/console assetic:dump --watch
Since running this command in the ``dev`` environment may generate a bunch
of files, it's usually a good idea to point your generated assets files to
of files, it's usually a good idea to point your generated asset files to
some isolated directory (e.g. ``/js/compiled``), to keep things organized:

.. configuration-block::
Expand Down

0 comments on commit ff9f315

Please sign in to comment.