Skip to content

Commit

Permalink
minor #3485 [Cookbook][Assetic] Fix "javascripts" tag name typo (bicpi)
Browse files Browse the repository at this point in the history
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
  • Loading branch information
weaverryan committed Feb 1, 2014
2 parents 3250aba + f9a287b commit d084d87
Showing 1 changed file with 34 additions and 6 deletions.
40 changes: 34 additions & 6 deletions cookbook/assetic/asset_management.rst
Original file line number Diff line number Diff line change
Expand Up @@ -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::

Expand All @@ -73,6 +71,22 @@ the default block names from the Symfony Standard Distribution:
<script type="text/javascript" src="<?php echo $view->escape($url) ?>"></script>
<?php endforeach; ?>
.. 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/*' %}
<script type="text/javascript" src="{{ asset_url }}"></script>
{% endjavascripts %}
{% endblock %}
{# ... #}
.. tip::

You can also include CSS Stylesheets: see :ref:`cookbook-assetic-including-css`.
Expand All @@ -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::

Expand All @@ -116,6 +128,22 @@ inside a ``stylesheets`` block:
<link rel="stylesheet" href="<?php echo $view->escape($url) ?>" />
<?php endforeach; ?>
.. 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' %}
<link rel="stylesheet" href="{{ asset_url }}" />
{% 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 <cookbook-assetic-cssrewrite>` filter.
Expand Down

0 comments on commit d084d87

Please sign in to comment.