From cf8064d09d5046d2109ab8f1a3073e90f8156d98 Mon Sep 17 00:00:00 2001
From: Philipp Rieber
Date: Fri, 17 Jan 2014 11:18:58 +0100
Subject: [PATCH 1/2] [Cookbook][Assetic] Fix "javascripts" tag name typo
---
cookbook/assetic/asset_management.rst | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/cookbook/assetic/asset_management.rst b/cookbook/assetic/asset_management.rst
index 48037824e45..259bfc21f8f 100644
--- a/cookbook/assetic/asset_management.rst
+++ b/cookbook/assetic/asset_management.rst
@@ -53,7 +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.
+To include JavaScript files, use the ``javascripts`` 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:
From f9a287b28c94303175fb79f12201d126508cd4d0 Mon Sep 17 00:00:00 2001
From: Philipp
Date: Sat, 18 Jan 2014 16:19:59 +0100
Subject: [PATCH 2/2] Move note about "javascripts" and "stylesheets" blocks to
separate note blocks
---
cookbook/assetic/asset_management.rst | 40 +++++++++++++++++++++++----
1 file changed, 34 insertions(+), 6 deletions(-)
diff --git a/cookbook/assetic/asset_management.rst b/cookbook/assetic/asset_management.rst
index 259bfc21f8f..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 ``javascripts`` 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.