diff --git a/cookbook/assetic/asset_management.rst b/cookbook/assetic/asset_management.rst index 48037824e45..4c4f7197ea9 100644 --- a/cookbook/assetic/asset_management.rst +++ b/cookbook/assetic/asset_management.rst @@ -53,9 +53,7 @@ behind adding either is basically the same, but with a slightly different syntax Including JavaScript Files ~~~~~~~~~~~~~~~~~~~~~~~~~~ -To include JavaScript files, use the ``javascript`` tag in any template. -This will most commonly live in the ``javascripts`` block, if you're using -the default block names from the Symfony Standard Distribution: +To include JavaScript files, use the ``javascripts`` tag in any template: .. configuration-block:: @@ -73,6 +71,22 @@ the default block names from the Symfony Standard Distribution: +.. note:: + + If you're using the default block names from the Symfony Standard Edition, + the ``javascripts`` tag will most commonly live in the ``javascripts`` + block: + + .. code-block:: html+jinja + + {# ... #} + {% block javascripts %} + {% javascripts '@AcmeFooBundle/Resources/public/js/*' %} + + {% endjavascripts %} + {% endblock %} + {# ... #} + .. tip:: You can also include CSS Stylesheets: see :ref:`cookbook-assetic-including-css`. @@ -95,9 +109,7 @@ Including CSS Stylesheets ~~~~~~~~~~~~~~~~~~~~~~~~~ To bring in CSS stylesheets, you can use the same methodologies seen -above, except with the ``stylesheets`` tag. If you're using the default -block names from the Symfony Standard Distribution, this will usually live -inside a ``stylesheets`` block: +above, except with the ``stylesheets`` tag: .. configuration-block:: @@ -116,6 +128,22 @@ inside a ``stylesheets`` block: +.. note:: + + If you're using the default block names from the Symfony Standard Edition, + the ``stylesheets`` tag will most commonly live in the ``stylesheets`` + block: + + .. code-block:: html+jinja + + {# ... #} + {% block stylesheets %} + {% stylesheets 'bundles/acme_foo/css/*' filter='cssrewrite' %} + + {% endstylesheets %} + {% endblock %} + {# ... #} + But because Assetic changes the paths to your assets, this *will* break any background images (or other paths) that uses relative paths, unless you use the :ref:`cssrewrite ` filter.