@@ -67,22 +67,11 @@ Filter a single File
67
67
You can now serve up a single CoffeeScript file as JavaScript from within your
68
68
templates:
69
69
70
- .. configuration-block ::
71
-
72
- .. code-block :: html+twig
73
-
74
- {% javascripts '@AppBundle/Resources/public/js/example.coffee' filter='coffee' %}
75
- <script src="{{ asset_url }}"></script>
76
- {% endjavascripts %}
70
+ .. code-block :: html+twig
77
71
78
- .. code-block :: html+php
79
-
80
- <?php foreach ($view['assetic']->javascripts(
81
- array('@AppBundle/Resources/public/js/example.coffee'),
82
- array('coffee')
83
- ) as $url): ?>
84
- <script src="<?php echo $view->escape($url) ?>"></script>
85
- <?php endforeach ?>
72
+ {% javascripts '@AppBundle/Resources/public/js/example.coffee' filter='coffee' %}
73
+ <script src="{{ asset_url }}"></script>
74
+ {% endjavascripts %}
86
75
87
76
This is all that's needed to compile this CoffeeScript file and serve it
88
77
as the compiled JavaScript.
@@ -92,27 +81,13 @@ Filter multiple Files
92
81
93
82
You can also combine multiple CoffeeScript files into a single output file:
94
83
95
- .. configuration-block ::
96
-
97
- .. code-block :: html+twig
84
+ .. code-block :: html+twig
98
85
99
- {% javascripts '@AppBundle/Resources/public/js/example.coffee'
100
- '@AppBundle/Resources/public/js/another.coffee'
101
- filter='coffee' %}
102
- <script src="{{ asset_url }}"></script>
103
- {% endjavascripts %}
104
-
105
- .. code-block :: html+php
106
-
107
- <?php foreach ($view['assetic']->javascripts(
108
- array(
109
- '@AppBundle/Resources/public/js/example.coffee',
110
- '@AppBundle/Resources/public/js/another.coffee',
111
- ),
112
- array('coffee')
113
- ) as $url): ?>
114
- <script src="<?php echo $view->escape($url) ?>"></script>
115
- <?php endforeach ?>
86
+ {% javascripts '@AppBundle/Resources/public/js/example.coffee'
87
+ '@AppBundle/Resources/public/js/another.coffee'
88
+ filter='coffee' %}
89
+ <script src="{{ asset_url }}"></script>
90
+ {% endjavascripts %}
116
91
117
92
Both files will now be served up as a single file compiled into regular JavaScript.
118
93
@@ -188,24 +163,12 @@ template. You can also list regular JavaScript files, all of which will be
188
163
combined and rendered as a single JavaScript file (with only the ``.coffee ``
189
164
files being run through the CoffeeScript filter):
190
165
191
- .. configuration-block ::
166
+ .. code-block :: html+twig
167
+
168
+ {% javascripts '@AppBundle/Resources/public/js/example.coffee'
169
+ '@AppBundle/Resources/public/js/another.coffee'
170
+ '@AppBundle/Resources/public/js/regular.js' %}
171
+ <script src="{{ asset_url }}"></script>
172
+ {% endjavascripts %}
173
+
192
174
193
- .. code-block :: html+twig
194
-
195
- {% javascripts '@AppBundle/Resources/public/js/example.coffee'
196
- '@AppBundle/Resources/public/js/another.coffee'
197
- '@AppBundle/Resources/public/js/regular.js' %}
198
- <script src="{{ asset_url }}"></script>
199
- {% endjavascripts %}
200
-
201
- .. code-block :: html+php
202
-
203
- <?php foreach ($view['assetic']->javascripts(
204
- array(
205
- '@AppBundle/Resources/public/js/example.coffee',
206
- '@AppBundle/Resources/public/js/another.coffee',
207
- '@AppBundle/Resources/public/js/regular.js',
208
- )
209
- ) as $url): ?>
210
- <script src="<?php echo $view->escape($url) ?>"></script>
211
- <?php endforeach ?>
0 commit comments