@@ -83,12 +83,12 @@ assets are cached.
83
83
84
84
Instead of relying on a simple version mechanism, the Asset component allows to
85
85
define advanced versioning strategies via PHP classes. The two built-in strategies
86
- provided by the component are :class: `Symfony\C omponent\A sset\V ersionStrategy\E mptyVersionStrategy `,
87
- which doesn't add any version to the asset and :class: `Symfony\C omponent\A sset\V ersionStrategy\S taticVersionStrategy `,
86
+ provided by the component are :class: `Symfony\\ Component\\ Asset\\ VersionStrategy\ \ EmptyVersionStrategy `,
87
+ which doesn't add any version to the asset and :class: `Symfony\\ Component\\ Asset\\ VersionStrategy\ \ StaticVersionStrategy `,
88
88
which allows to set the version with a format string.
89
89
90
- In this example, the :class: ` Symfony \C omponent \A sset \V ersionStrategy \ S taticVersionStrategy `
91
- is used to append the `` v1 `` suffix to any asset path::
90
+ In this example, the `` StaticVersionStrategy `` is used to append the `` v1 ` `
91
+ suffix to any asset path::
92
92
93
93
use Symfony\Component\Asset\Package;
94
94
use Symfony\Component\Asset\VersionStrategy\StaticVersionStrategy;
@@ -99,8 +99,7 @@ is used to append the ``v1`` suffix to any asset path::
99
99
// result: /image.png?v1
100
100
101
101
In case you want to modify the version format, pass a sprintf-compatible format
102
- string as the second argument of the
103
- :class: `Symfony\C omponent\A sset\V ersionStrategy\S taticVersionStrategy ` constructor::
102
+ string as the second argument of the ``StaticVersionStrategy `` constructor::
104
103
105
104
// put the 'version' word before the version value
106
105
$package = new Package(new StaticVersionStrategy('v1', '%s?version=%s'));
@@ -117,7 +116,7 @@ string as the second argument of the
117
116
Custom Version Strategies
118
117
.........................
119
118
120
- Use the :class: `Symfony\C omponent\A sset\V ersionStrategy\V ersionStrategyInterface `
119
+ Use the :class: `Symfony\\ Component\\ Asset\\ VersionStrategy\ \ VersionStrategyInterface `
121
120
to define your own version strategy. For example, you could define a versioning
122
121
where the current date is appended to bust the cache every day::
123
122
@@ -147,9 +146,9 @@ Grouped Assets
147
146
~~~~~~~~~~~~~~
148
147
149
148
It's common for applications to store their assets in a common path. If that's
150
- your case, replace the default :class: `Symfony\C omponent\A sset\P ackage ` class by
151
- :class: `Symfony\C omponent\A sset\P athPackage ` to avoid repeating the same path
152
- time and again::
149
+ your case, replace the default :class: `Symfony\\ Component\\ Asset\\ Package ` class
150
+ by :class: `Symfony\\ Component\\ Asset\\ PathPackage ` to avoid repeating the same
151
+ path time and again::
153
152
154
153
use Symfony\Component\Asset\PathPackage;
155
154
// ...
@@ -163,8 +162,8 @@ Request Context Aware Assets
163
162
............................
164
163
165
164
If you are also using the HttpFoundation component in your project, for example
166
- in a Symfony application, the :class: ` Symfony \C omponent \A sset \ P athPackage ` class
167
- can take into account the context of the current request::
165
+ in a Symfony application, the `` PathPackage `` class can take into account the
166
+ context of the current request::
168
167
169
168
use Symfony\Component\Asset\PathPackage;
170
169
use Symfony\Component\Asset\Context\RequestStackContext;
@@ -180,15 +179,15 @@ can take into account the context of the current request::
180
179
// result: /somewhere/static/images/logo.png?v1
181
180
182
181
When the request context is set (via the third optional argument), in addition
183
- to the configured base path, :class: ` Symfony \C omponent \A sset \ P athPackage ` also
184
- prepends the current request base URL (``/somewhere/ `` in this example) to assets.
185
- This allows your website to be hosted anywhere under the web server root directory.
182
+ to the configured base path, `` PathPackage `` also prepends the current request
183
+ base URL (``/somewhere/ `` in this example) to assets. This allows your website
184
+ to be hosted anywhere under the web server root directory.
186
185
187
186
Absolute Assets and CDNs
188
187
~~~~~~~~~~~~~~~~~~~~~~~~
189
188
190
189
Applications that host their assets on different domains and CDNs (*Content
191
- Delivery Networks *) should use the :class: `Symfony\C omponent\A sset\U rlPackage `
190
+ Delivery Networks *) should use the :class: `Symfony\\ Component\\ Asset\ \ UrlPackage `
192
191
class to generate absolute URLs for their assets::
193
192
194
193
use Symfony\Component\Asset\UrlPackage;
@@ -203,8 +202,8 @@ class to generate absolute URLs for their assets::
203
202
// result: http://static.example.com/images/logo.png?v1
204
203
205
204
In case you serve assets from more than one domain to improve application
206
- performance, pass an array of URLs as the first argument of
207
- :class: ` Symfony \C omponent \A sset \U rlPackage ` constructor::
205
+ performance, pass an array of URLs as the first argument of `` UrlPackage ``
206
+ constructor::
208
207
209
208
use Symfony\Component\Asset\UrlPackage;
210
209
// ...
@@ -248,7 +247,7 @@ Named Packages
248
247
249
248
Applications that manage lots of different assets may need to group them in
250
249
packages with the same versioning strategy and base path. The Asset component
251
- includes a :class: `Symfony\C omponent\A sset\P ackages ` class to simplify the
250
+ includes a :class: `Symfony\\ Component\\ Asset\ \ Packages ` class to simplify the
252
251
management of several packages.
253
252
254
253
In the following example, all packages use the same versioning strategy, but
@@ -271,11 +270,11 @@ they all have different base paths::
271
270
272
271
$packages = new Packages($defaultPackage, $namedPackages)
273
272
274
- The :class: ` Symfony \C omponent \A sset \ P ackages ` class allows to define a default
275
- package, which will be applied to assets that don't define the name of package
276
- to use. In addition, this application defines a package named ``img `` to serve
277
- images from an external domain and a ``doc `` package to avoid repeating long
278
- paths when linking to a document inside a template::
273
+ The `` Packages `` class allows to define a default package, which will be applied
274
+ to assets that don't define the name of package to use. In addition, this
275
+ application defines a package named ``img `` to serve images from an external
276
+ domain and a ``doc `` package to avoid repeating long paths when linking to a
277
+ document inside a template::
279
278
280
279
echo $packages->getUrl('/main.css');
281
280
// result: /main.css?v1
0 commit comments