@@ -1093,8 +1093,61 @@ version_strategy
1093
1093
1094
1094
**type **: ``string `` **default **: ``null ``
1095
1095
1096
- The service id of the :doc: `asset version strategy </frontend/custom_version_strategy >`
1097
- applied to the assets.
1096
+ The service id of the asset version strategy applied to the assets. In addition
1097
+ to your own :doc: `custom asset version strategies </frontend/custom_version_strategy >`,
1098
+ Symfony defines two services for its :ref: `built-in strategies <component-assets-versioning >`:
1099
+ ``assets.empty_version_strategy `` and ``assets.static_version_strategy ``.
1100
+
1101
+ The ``assets.empty_version_strategy `` is useful to override the global asset
1102
+ versioning strategy inside an asset package:
1103
+
1104
+ .. configuration-block ::
1105
+
1106
+ .. code-block :: yaml
1107
+
1108
+ # app/config/config.yml
1109
+ framework :
1110
+ assets :
1111
+ # this strategy is applied to every asset (including packages) ...
1112
+ version_strategy : ' app.asset.my_versioning_strategy'
1113
+ packages :
1114
+ foo_package :
1115
+ # ... except if a package explicitly uses the empty strategy
1116
+ version_strategy : ' assets.empty_version_strategy'
1117
+
1118
+ .. code-block :: xml
1119
+
1120
+ <!-- app/config/config.xml -->
1121
+ <?xml version =" 1.0" encoding =" UTF-8" ?>
1122
+ <container xmlns =" http://symfony.com/schema/dic/services"
1123
+ xmlns : xsi =" http://www.w3.org/2001/XMLSchema-instance"
1124
+ xmlns : framework =" http://symfony.com/schema/dic/symfony"
1125
+ xsi : schemaLocation =" http://symfony.com/schema/dic/services http://symfony.com/schema/dic/services/services-1.0.xsd
1126
+ http://symfony.com/schema/dic/symfony http://symfony.com/schema/dic/symfony/symfony-1.0.xsd" >
1127
+
1128
+ <framework : config >
1129
+ <framework : assets version_strategy =" app.asset.my_versioning_strategy" >
1130
+ <framework : package
1131
+ name =" foo_package"
1132
+ version-strategy =" assets.empty_version_strategy" />
1133
+ </framework : assets >
1134
+ </framework : config >
1135
+ </container >
1136
+
1137
+ .. code-block :: php
1138
+
1139
+ // app/config/config.php
1140
+ $container->loadFromExtension('framework', array(
1141
+ 'assets' => array(
1142
+ 'version_strategy' => 'app.asset.my_versioning_strategy',
1143
+ 'packages' => array(
1144
+ 'foo_package' => array(
1145
+ // ...
1146
+ 'version_strategy' => 'assets.empty_version_strategy',
1147
+ ),
1148
+ ),
1149
+ ),
1150
+ ));
1098
1151
1099
1152
.. note ::
1100
1153
0 commit comments