Skip to content

Commit 3b8d408

Browse files
committed
Simplified the intro
1 parent b770f79 commit 3b8d408

File tree

1 file changed

+9
-46
lines changed

1 file changed

+9
-46
lines changed

cookbook/asset/custom_version_strategy.rst

Lines changed: 9 additions & 46 deletions
Original file line numberDiff line numberDiff line change
@@ -7,54 +7,17 @@ How to Use a Custom Version Strategy for Assets
77
.. versionadded:: 2.7
88
The Asset component was introduced in Symfony 2.7.
99

10-
Symfony by default does not perform asset versioning. You can specify the
10+
Asset versioning is a technique that improves the performance of web
11+
applications by adding a version identifier to the URL of your static assets
12+
(CSS, JavaScript, images, etc.) When the content of the asset changes, the
13+
identifier changes and the browser is forced to download it again instead of
14+
using the cached version.
15+
16+
Symfony supports the basic asset versioning thanks to the
1117
:ref:`version <reference-framework-assets-version>` and
1218
:ref:`version_format <reference-framework-assets-version-format>` configuration
13-
options to add a simple version to all assets (or a specific set of assets
14-
grouped as a :ref:`package <reference-framework-assets-packages>`):
15-
16-
.. configuration-block::
17-
18-
.. code-block:: yaml
19-
20-
# app/config/config.yml
21-
framework:
22-
assets:
23-
version: "20150530"
24-
version_format: "%%s?version=%%s"
25-
26-
.. code-block:: xml
27-
28-
<!-- app/config/config.xml -->
29-
<?xml version="1.0" encoding="UTF-8" ?>
30-
<container xmlns="http://symfony.com/schema/dic/services"
31-
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
32-
xmlns:framework="http://symfony.com/schema/dic/symfony"
33-
xsi:schemaLocation="http://symfony.com/schema/dic/services
34-
http://symfony.com/schema/dic/services/services-1.0.xsd
35-
http://symfony.com/schema/dic/symfony
36-
http://symfony.com/schema/dic/symfony/symfony-1.0.xsd"
37-
>
38-
<framework:config>
39-
<framework:assets
40-
version="20150530"
41-
version-format="%%s?version=%%s"
42-
/>
43-
</framework:config>
44-
</container>
45-
46-
.. code-block:: php
47-
48-
// app/config/config.php
49-
$container->loadFromExtension('framework', array(
50-
'assets' => array(
51-
'version' => '20150530',
52-
'version_format' => '%%s?version=%%s',
53-
),
54-
));
55-
56-
However, if you require more control, you need to create a custom version
57-
strategy.
19+
options. If your application requires a more advanced versioning, you can create
20+
your own version strategy.
5821

5922
Default Package
6023
---------------

0 commit comments

Comments
 (0)