@@ -53,9 +53,7 @@ behind adding either is basically the same, but with a slightly different syntax
53
53
Including JavaScript Files
54
54
~~~~~~~~~~~~~~~~~~~~~~~~~~
55
55
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:
59
57
60
58
.. configuration-block ::
61
59
@@ -73,6 +71,22 @@ the default block names from the Symfony Standard Distribution:
73
71
<script type="text/javascript" src="<?php echo $view->escape($url) ?>"></script>
74
72
<?php endforeach; ?>
75
73
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
+
76
90
.. tip ::
77
91
78
92
You can also include CSS Stylesheets: see :ref: `cookbook-assetic-including-css `.
@@ -95,9 +109,7 @@ Including CSS Stylesheets
95
109
~~~~~~~~~~~~~~~~~~~~~~~~~
96
110
97
111
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:
101
113
102
114
.. configuration-block ::
103
115
@@ -116,6 +128,22 @@ inside a ``stylesheets`` block:
116
128
<link rel="stylesheet" href="<?php echo $view->escape($url) ?>" />
117
129
<?php endforeach; ?>
118
130
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
+
119
147
But because Assetic changes the paths to your assets, this *will * break any
120
148
background images (or other paths) that uses relative paths, unless you use
121
149
the :ref: `cssrewrite <cookbook-assetic-cssrewrite >` filter.
0 commit comments