@@ -69,9 +69,10 @@ Configuration
69
69
* `gc_probability `_
70
70
* `gc_maxlifetime `_
71
71
* `save_path `_
72
+ * `assets `_
73
+ * `version `_
74
+ * `version_format `_
72
75
* `templating `_
73
- * `assets_version `_
74
- * `assets_version_format `_
75
76
* `hinclude_default_template `_
76
77
* :ref: `form <reference-templating-form >`
77
78
* `resources `_
@@ -850,14 +851,13 @@ setting the value to ``null``:
850
851
),
851
852
));
852
853
853
- templating
854
- ~~~~~~~~~~
854
+ assets
855
+ ~~~~~~
855
856
856
857
.. _reference-framework-assets-version :
857
- .. _ref-framework-assets-version :
858
858
859
- assets_version
860
- ..............
859
+ version
860
+ .......
861
861
862
862
**type **: ``string ``
863
863
@@ -879,7 +879,7 @@ For example, suppose you have the following:
879
879
<img src =" <?php echo $view['assets']->getUrl('images/logo.png') ?>" alt =" Symfony!" />
880
880
881
881
By default, this will render a path to your image such as ``/images/logo.png ``.
882
- Now, activate the ``assets_version `` option:
882
+ Now, activate the ``version `` option:
883
883
884
884
.. configuration-block ::
885
885
@@ -888,7 +888,10 @@ Now, activate the ``assets_version`` option:
888
888
# app/config/config.yml
889
889
framework :
890
890
# ...
891
- templating : { engines: ['twig'], assets_version: v2 }
891
+ assets :
892
+ version : ' v2'
893
+ templating :
894
+ engines : ['twig']
892
895
893
896
.. code-block :: xml
894
897
@@ -900,7 +903,8 @@ Now, activate the ``assets_version`` option:
900
903
xsi : schemaLocation =" http://symfony.com/schema/dic/services http://symfony.com/schema/dic/services/services-1.0.xsd
901
904
http://symfony.com/schema/dic/symfony http://symfony.com/schema/dic/symfony/symfony-1.0.xsd" >
902
905
903
- <framework : templating assets-version =" v2" >
906
+ <framework : assets version =" v2" >
907
+ <framework : templating >
904
908
<!-- ... -->
905
909
<framework : engine >twig</framework : engine >
906
910
</framework : templating >
@@ -911,40 +915,42 @@ Now, activate the ``assets_version`` option:
911
915
// app/config/config.php
912
916
$container->loadFromExtension('framework', array(
913
917
// ...
914
- 'templating' => array(
915
- 'engines' => array('twig'),
916
- 'assets_version' => 'v2',
918
+ 'assets' => array(
919
+ 'version' => 'v2',
920
+ ),
921
+ 'templating' => array(
922
+ 'engines' => array('twig'),
917
923
),
918
924
));
919
925
920
926
Now, the same asset will be rendered as ``/images/logo.png?v2 `` If you use
921
- this feature, you **must ** manually increment the ``assets_version `` value
927
+ this feature, you **must ** manually increment the ``version `` value
922
928
before each deployment so that the query parameters change.
923
929
924
930
It's also possible to set the version value on an asset-by-asset basis (instead
925
931
of using the global version - e.g. ``v2 `` - set here). See
926
932
:ref: `Versioning by Asset <book-templating-version-by-asset >` for details.
927
933
928
- You can also control how the query string works via the `assets_version_format `_
934
+ You can also control how the query string works via the `version_format `_
929
935
option.
930
936
931
937
.. tip ::
932
938
933
939
As with all settings, you can use a parameter as value for the
934
- ``assets_version ``. This makes it easier to increment the cache on each
940
+ ``version ``. This makes it easier to increment the cache on each
935
941
deployment.
936
942
937
- .. _reference-templating -version-format :
943
+ .. _reference-assets -version-format :
938
944
939
- assets_version_format
940
- .....................
945
+ version_format
946
+ ..............
941
947
942
948
**type **: ``string `` **default **: ``%%s?%%s ``
943
949
944
950
This specifies a :phpfunction: `sprintf ` pattern that will be used with the
945
- `assets_version `_ option to construct an asset's path. By default, the pattern
951
+ `version `_ option to construct an asset's path. By default, the pattern
946
952
adds the asset's version as a query string. For example, if
947
- ``assets_version_format `` is set to ``%%s?version=%%s `` and ``assets_version ``
953
+ ``version_format `` is set to ``%%s?version=%%s `` and ``version ``
948
954
is set to ``5 ``, the asset's path would be ``/images/logo.png?version=5 ``.
949
955
950
956
.. note ::
@@ -957,7 +963,7 @@ is set to ``5``, the asset's path would be ``/images/logo.png?version=5``.
957
963
958
964
Some CDN's do not support cache-busting via query strings, so injecting
959
965
the version into the actual file path is necessary. Thankfully,
960
- ``assets_version_format `` is not limited to producing versioned query
966
+ ``version_format `` is not limited to producing versioned query
961
967
strings.
962
968
963
969
The pattern receives the asset's original path and version as its first
@@ -973,6 +979,9 @@ is set to ``5``, the asset's path would be ``/images/logo.png?version=5``.
973
979
any URL rewriting. The latter option is useful if you would like older
974
980
asset versions to remain accessible at their original URL.
975
981
982
+ templating
983
+ ~~~~~~~~~~
984
+
976
985
hinclude_default_template
977
986
.........................
978
987
@@ -1277,7 +1286,7 @@ Each package can configure the following options:
1277
1286
1278
1287
* :ref: `base_urls <reference-templating-base-urls >`
1279
1288
* :ref: `version <reference-framework-assets-version >`
1280
- * :ref: `version_format <reference-templating -version-format >`
1289
+ * :ref: `version_format <reference-assets -version-format >`
1281
1290
1282
1291
translator
1283
1292
~~~~~~~~~~
@@ -1589,10 +1598,13 @@ Full Default Configuration
1589
1598
serializer :
1590
1599
enabled : false
1591
1600
1601
+ # assets configuration
1602
+ assets :
1603
+ version : ~
1604
+ version_format : ' %%s?%%s'
1605
+
1592
1606
# templating configuration
1593
1607
templating :
1594
- assets_version : ~
1595
- assets_version_format : ' %%s?%%s'
1596
1608
hinclude_default_template : ~
1597
1609
form :
1598
1610
resources :
0 commit comments