8000 Lots of fixes and rewordings · symfony/symfony-docs@7ab379a · GitHub
[go: up one dir, main page]

Skip to content

Commit 7ab379a

Browse files
javiereguiluzweaverryan
authored andcommitted
Lots of fixes and rewordings
1 parent 9e8de96 commit 7ab379a

File tree

1 file changed

+23
-22
lines changed

1 file changed

+23
-22
lines changed

components/asset/introduction.rst

Lines changed: 23 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,8 @@ The Asset Component
88
The Asset component manages URL generation and versioning of web assets such
99
as CSS stylesheets, JavaScript files and image files.
1010

11-
In the past, it was common for web applications to hardcode the URLs of the web
12-
assets. For example:
11+
In the past, it was common for web applications to hardcode URLs of web assets.
12+
For example:
1313

1414
.. code-block:: html
1515

@@ -20,23 +20,23 @@ assets. For example:
2020
<a href="/"><img src="/images/logo.png"></a>
2121

2222
This practice is no longer recommended unless the web application is extremely
23-
simple. The main problems of hardcoding asset URLs are the following:
23+
simple. Hardcoding URLs can be a disadvantage because:
2424

25-
* **Templates get verbose** because you have to write the full path for each
25+
* **Templates get verbose**: you have to write the full path for each
2626
asset. When using the Asset component, you can group assets in packages to
27-
avoid repeating the common part of their path.
28-
* **Versioning is difficult** because it has to be custom managed for each
27+
avoid repeating the common part of their path;
28+
* **Versioning is difficult**: it has to be custom managed for each
2929
application. Adding a version to the asset URLs is essential for some applications
3030
because it allows to control how the assets are cached. The Asset component
31-
allows to define different versioning strategies for each package.
32-
* **Moving assets location** is cumbersome and error-prone, because it requires
33-
you to carefully update the URLs of all assets included in all templates.
34-
The Asset component allows to move assets effortlessly just by changing the
35-
base path value associated with the package of assets.
36-
* **Impossible to use multiple CDNs** because it requires to change the URL of
37-
the asset randomly for each request. The Asset component provides out-of-the-box
38-
support for any number of multiple CDNs, both regular (``http://``) and
39-
secure (``https://``).
31+
allows to define different versioning strategies for each package;
32+
* **Moving assets location** is cumbersome and error-prone: it requires you to
33+
carefully update the URLs of all assets included in all templates. The Asset
34+
component allows to move assets effortlessly just by changing the base path
35+
value associated with the package of assets;
36+
* **It's nearly impossible to use multiple CDNs**: this technique requires to
37+
change the URL of the asset randomly for each request. The Asset component
38+
provides out-of-the-box support for any number of multiple CDNs, both regular
39+
(``http://``) and secure (``https://``).
4040

4141
Installation
4242
------------
@@ -117,8 +117,9 @@ Custom Version Strategies
117117
.........................
118118

119119
Use the :class:`Symfony\\Component\\Asset\\VersionStrategy\\VersionStrategyInterface`
120-
to define your own version strategy. For example, you could define a versioning
121-
where the current date is a 8000 ppended to bust the cache every day::
120+
to define your own versioning strategy. For example, your application may need
121+
to append the current date to all its web assets in order to bust the cache
122+
every day::
122123

123124
use Symfony\Component\Asset\VersionStrategy\VersionStrategyInterface;
124125

@@ -178,10 +179,10 @@ context of the current request::
178179
echo $package->getUrl('/logo.png');
179180
// result: /somewhere/static/images/logo.png?v1
180181

181-
When the request context is set (via the third optional argument), in addition
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.
182+
When the request context is set (via an optional third argument), in addition to
183+
the configured base path, ``PathPackage`` also prepends the current request base
184+
URL (``/somewhere/`` in this example) to assets. This allows your website to be
185+
hosted anywhere under the web server root directory.
185186

186187
Absolute Assets and CDNs
187188
~~~~~~~~~~~~~~~~~~~~~~~~
@@ -247,7 +248,7 @@ Named Packages
247248

248249
Applications that manage lots of different assets may need to group them in
249250
packages with the same versioning strategy and base path. The Asset component
250-
includes a :class:`Symfony\\Component\\Asset\\Packages` class to simplify the
251+
includes a :class:`Symfony\\Component\\Asset\\Packages` class to simplify
251252
management of several packages.
252253

253254
In the following example, all packages use the same versioning strategy, but

0 commit comments

Comments
 (0)
0