Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commitf9a287b

Browse files
committed
Move note about "javascripts" and "stylesheets" blocks to separate note blocks
1 parentcf8064d commitf9a287b

File tree

1 file changed

+34
-6
lines changed

1 file changed

+34
-6
lines changed

‎cookbook/assetic/asset_management.rst

Lines changed: 34 additions & 6 deletions
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 ``javascripts`` 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)

[8]ページ先頭

©2009-2025 Movatter.jp