@@ -69,9 +69,10 @@ Configuration
6969 * `gc_probability `_
7070 * `gc_maxlifetime `_
7171 * `save_path `_
72+ * `assets `_
73+ * `version `_
74+ * `version_format `_
7275* `templating `_
73- * `assets_version `_
74- * `assets_version_format `_
7576 * `hinclude_default_template `_
7677 * :ref: `form <reference-templating-form >`
7778 * `resources `_
@@ -850,14 +851,13 @@ setting the value to ``null``:
850851 ),
851852 ));
852853
853- templating
854- ~~~~~~~~~~
854+ assets
855+ ~~~~~~
855856
856857.. _reference-framework-assets-version :
857- .. _ref-framework-assets-version :
858858
859- assets_version
860- ..............
859+ version
860+ .......
861861
862862**type **: ``string ``
863863
@@ -879,7 +879,7 @@ For example, suppose you have the following:
879879 <img src =" <?php echo $view['assets']->getUrl('images/logo.png') ?>" alt =" Symfony!" />
880880
881881 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:
883883
884884.. configuration-block ::
885885
@@ -888,7 +888,10 @@ Now, activate the ``assets_version`` option:
888888 # app/config/config.yml
889889 framework :
890890 # ...
891- templating : { engines: ['twig'], assets_version: v2 }
891+ assets :
892+ version : ' v2'
893+ templating :
894+ engines : ['twig']
892895
893896 .. code-block :: xml
894897
@@ -900,7 +903,8 @@ Now, activate the ``assets_version`` option:
900903 xsi : schemaLocation =" http://symfony.com/schema/dic/services http://symfony.com/schema/dic/services/services-1.0.xsd
901904 http://symfony.com/schema/dic/symfony http://symfony.com/schema/dic/symfony/symfony-1.0.xsd" >
902905
903- <framework : templating assets-version =" v2" >
906+ <framework : assets version =" v2" >
907+ <framework : templating >
904908 <!-- ... -->
905909 <framework : engine >twig</framework : engine >
906910 </framework : templating >
@@ -911,40 +915,42 @@ Now, activate the ``assets_version`` option:
911915 // app/config/config.php
912916 $container->loadFromExtension('framework', array(
913917 // ...
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'),
917923 ),
918924 ));
919925
920926 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
922928before each deployment so that the query parameters change.
923929
924930It's also possible to set the version value on an asset-by-asset basis (instead
925931of using the global version - e.g. ``v2 `` - set here). See
926932:ref: `Versioning by Asset <book-templating-version-by-asset >` for details.
927933
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 `_
929935option.
930936
931937.. tip ::
932938
933939 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
935941 deployment.
936942
937- .. _reference-templating -version-format :
943+ .. _reference-assets -version-format :
938944
939- assets_version_format
940- .....................
945+ version_format
946+ ..............
941947
942948**type **: ``string `` **default **: ``%%s?%%s ``
943949
944950This 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
946952adds 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 ``
948954is set to ``5 ``, the asset's path would be ``/images/logo.png?version=5 ``.
949955
950956.. note ::
@@ -957,7 +963,7 @@ is set to ``5``, the asset's path would be ``/images/logo.png?version=5``.
957963
958964 Some CDN's do not support cache-busting via query strings, so injecting
959965 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
961967 strings.
962968
963969 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``.
973979 any URL rewriting. The latter option is useful if you would like older
974980 asset versions to remain accessible at their original URL.
975981
982+ templating
983+ ~~~~~~~~~~
984+
976985hinclude_default_template
977986.........................
978987
@@ -1277,7 +1286,7 @@ Each package can configure the following options:
12771286
12781287* :ref: `base_urls <reference-templating-base-urls >`
12791288* :ref: `version <reference-framework-assets-version >`
1280- * :ref: `version_format <reference-templating -version-format >`
1289+ * :ref: `version_format <reference-assets -version-format >`
12811290
12821291translator
12831292~~~~~~~~~~
@@ -1589,10 +1598,13 @@ Full Default Configuration
15891598 serializer :
15901599 enabled : false
15911600
1601+ # assets configuration
1602+ assets :
1603+ version : ~
1604+ version_format : ' %%s?%%s'
1605+
15921606 # templating configuration
15931607 templating :
1594- assets_version : ~
1595- assets_version_format : ' %%s?%%s'
15961608 hinclude_default_template : ~
15971609 form :
15981610 resources :
0 commit comments