Skip to content

Commit d084d87

Browse files
committed
minor symfony#3485 [Cookbook][Assetic] Fix "javascripts" tag name typo (bicpi)
This PR was merged into the 2.3 branch. Discussion ---------- [Cookbook][Assetic] Fix "javascripts" tag name typo | Q | A | ------------- | --- | Doc fix? | yes | New docs? | no | Applies to | all | Fixed tickets | - Maybe the following note *This will most commonly live in the ``javascripts`` block...* is a bit confusing because the example does not show this Twig block and it has the same name as the Twig tag... The note could either be removed or I could add the `javascripts` Twig block to clarify? Commits ------- f9a287b Move note about "javascripts" and "stylesheets" blocks to separate note blocks cf8064d [Cookbook][Assetic] Fix "javascripts" tag name typo
2 parents 3250aba + f9a287b commit d084d87

File tree

1 file changed

+34
-6
lines changed

1 file changed

+34
-6
lines changed

cookbook/assetic/asset_management.rst

+34-6
Original file line numberDiff line numberDiff line change
@@ -53,9 +53,7 @@ behind adding either is basically the same, but with a slightly different syntax
5353
Including JavaScript Files
5454
~~~~~~~~~~~~~~~~~~~~~~~~~~
5555

56-
To include JavaScript files, use the ``javascript`` tag in any template.
57-
This will most commonly live in the ``javascripts`` block, if you're using
58-
the default block names from the Symfony Standard Distribution:
56+
To include JavaScript files, use the ``javascripts`` tag in any template:
5957

6058
.. configuration-block::
6159

@@ -73,6 +71,22 @@ the default block names from the Symfony Standard Distribution:
7371
<script type="text/javascript" src="<?php echo $view->escape($url) ?>"></script>
7472
<?php endforeach; ?>
7573
74+
.. note::
75+
76+
If you're using the default block names from the Symfony Standard Edition,
77+
the ``javascripts`` tag will most commonly live in the ``javascripts``
78+
block:
79+
80+
.. code-block:: html+jinja
81+
82+
{# ... #}
83+
{% block javascripts %}
84+
{% javascripts '@AcmeFooBundle/Resources/public/js/*' %}
85+
<script type="text/javascript" src="{{ asset_url }}"></script>
86+
{% endjavascripts %}
87+
{% endblock %}
88+
{# ... #}
89+
7690
.. tip::
7791

7892
You can also include CSS Stylesheets: see :ref:`cookbook-assetic-including-css`.
@@ -95,9 +109,7 @@ Including CSS Stylesheets
95109
~~~~~~~~~~~~~~~~~~~~~~~~~
96110

97111
To bring in CSS stylesheets, you can use the same methodologies seen
98-
above, except with the ``stylesheets`` tag. If you're using the default
99-
block names from the Symfony Standard Distribution, this will usually live
100-
inside a ``stylesheets`` block:
112+
above, except with the ``stylesheets`` tag:
101113

102114
.. configuration-block::
103115

@@ -116,6 +128,22 @@ inside a ``stylesheets`` block:
116128
<link rel="stylesheet" href="<?php echo $view->escape($url) ?>" />
117129
<?php endforeach; ?>
118130
131+
.. note::
132+
133+
If you're using the default block names from the Symfony Standard Edition,
134+
the ``stylesheets`` tag will most commonly live in the ``stylesheets``
135+
block:
136+
137+
.. code-block:: html+jinja
138+
139+
{# ... #}
140+
{% block stylesheets %}
141+
{% stylesheets 'bundles/acme_foo/css/*' filter='cssrewrite' %}
142+
<link rel="stylesheet" href="{{ asset_url }}" />
143+
{% endstylesheets %}
144+
{% endblock %}
145+
{# ... #}
146+
119147
But because Assetic changes the paths to your assets, this *will* break any
120148
background images (or other paths) that uses relative paths, unless you use
121149
the :ref:`cssrewrite <cookbook-assetic-cssrewrite>` filter.

0 commit comments

Comments
 (0)