Skip to content

Commit 9405e65

Browse files
javiereguiluzxabbuh
authored andcommitted
Improved the explanation of "version_strategy" option
1 parent 3e74145 commit 9405e65

File tree

1 file changed

+70
-1
lines changed

1 file changed

+70
-1
lines changed

reference/configuration/framework.rst

Lines changed: 70 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1116,7 +1116,76 @@ version_strategy
11161116
**type**: ``string`` **default**: ``null``
11171117

11181118
The service id of the :doc:`asset version strategy </frontend/custom_version_strategy>`
1119-
applied to the assets.
1119+
applied to the assets. This option can be set globally for all assets and
1120+
individually for each asset package:
1121+
1122+
.. configuration-block::
1123+
1124+
.. code-block:: yaml
1125+
1126+
# app/config/config.yml
1127+
framework:
1128+
assets:
1129+
# this strategy is applied to every asset (including packages)
1130+
version_strategy: 'app.asset.my_versioning_strategy'
1131+
packages:
1132+
foo_package:
1133+
# this package removes any versioning (its assets won't be versioned)
1134+
version: ~
1135+
bar_package:
1136+
# this package uses its own strategy (the default strategy is ignored)
1137+
version_strategy: 'app.asset.another_version_strategy'
1138+
baz_package:
1139+
# this package inherits the default strategy
1140+
base_path: '/images'
1141+
1142+
.. code-block:: xml
1143+
1144+
<!-- app/config/config.xml -->
1145+
<?xml version="1.0" encoding="UTF-8" ?>
1146+
<container xmlns="http://symfony.com/schema/dic/services"
1147+
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
1148+
xmlns:framework="http://symfony.com/schema/dic/symfony"
1149+
xsi:schemaLocation="http://symfony.com/schema/dic/services http://symfony.com/schema/dic/services/services-1.0.xsd
1150+
http://symfony.com/schema/dic/symfony http://symfony.com/schema/dic/symfony/symfony-1.0.xsd">
1151+
1152+
<framework:config>
1153+
<framework:assets version_strategy="app.asset.my_versioning_strategy">
1154+
<framework:package
1155+
name="foo_package"
1156+
version="null" />
1157+
<framework:package
1158+
name="bar_package"
1159+
version-strategy="app.asset.another_version_strategy" />
1160+
<framework:package
1161+
name="baz_package"
1162+
base_path="/images" />
1163+
</framework:assets>
1164+
</framework:config>
1165+
</container>
1166+
1167+
.. code-block:: php
1168+
1169+
// app/config/config.php
1170+
$container->loadFromExtension('framework', array(
1171+
'assets' => array(
1172+
'version_strategy' => 'app.asset.my_versioning_strategy',
1173+
'packages' => array(
1174+
'foo_package' => array(
1175+
// ...
1176+
'version' => null,
1177+
),
1178+
'bar_package' => array(
1179+
// ...
1180+
'version_strategy' => 'app.asset.another_version_strategy',
1181+
),
1182+
'baz_package' => array(
1183+
// ...
1184+
'base_path' => '/images',
1185+
),
1186+
),
1187+
),
1188+
));
11201189
11211190
.. note::
11221191

0 commit comments

Comments
 (0)