@@ -71,6 +71,7 @@ Configuration
71
71
* `version_strategy `_
72
72
* `version `_
73
73
* `version_format `_
74
+ * `json_manifest_path `_
74
75
* `templating `_
75
76
* `hinclude_default_template `_
76
77
* :ref: `form <reference-templating-form >`
@@ -980,6 +981,7 @@ Each package can configure the following options:
980
981
* :ref: `version_strategy <reference-assets-version-strategy >`
981
982
* :ref: `version <reference-framework-assets-version >`
982
983
* :ref: `version_format <reference-assets-version-format >`
984
+ * :ref: `json_manifest_path <reference-assets-json-manifest-path >`
983
985
984
986
.. _reference-framework-assets-version :
985
987
.. _ref-framework-assets-version :
9E81
@@ -1054,7 +1056,7 @@ option.
1054
1056
1055
1057
.. note ::
1056
1058
1057
- This parameter cannot be set at the same time as ``version_strategy ``.
1059
+ This parameter cannot be set at the same time as ``version_strategy `` or `` json_manifest_path `` .
1058
1060
1059
1061
.. tip ::
1060
1062
@@ -1187,7 +1189,105 @@ individually for each asset package:
1187
1189
1188
1190
.. note ::
1189
1191
1190
- This parameter cannot be set at the same time as ``version ``.
1192
+ This parameter cannot be set at the same time as ``version `` or ``json_manifest_path ``.
1193
+
1194
+ .. _reference-assets-json-manifest-path :
1195
+ .. _reference-templating-json-manifest-path :
1196
+
1197
+ json_manifest_path
1198
+ ..................
1199
+
1200
+ **type **: ``string `` **default **: ``null ``
1201
+
1202
+ .. versionadded :: 3.3
1203
+
1204
+ The ``json_manifest_path `` option was introduced in Symfony 3.3.
1205
+
1206
+ The file path to a ``manifest.json `` file containing an associative array of asset
1207
+ names and their respective compiled names. A common cache-busting technique using
1208
+ a "manifest" file works by writing out assets with a "hash" appended to their
1209
+ file names (e.g. ``main.ae433f1cb.css ``) during a front-end compilation routine.
1210
+
1211
+ .. tip ::
1212
+
1213
+ Symfony's :ref: `Webpack Encore <frontend-webpack-encore >` supports
1214
+ :ref: `outputting hashed assets <encore-long-term-caching >`. Moreover, this
1215
+ can be incorporate this into many other workflows, including Webpack and
1216
+ Gulp using `webpack-manifest-plugin `_ and `gulp-rev `_, respectfully.
1217
+
1218
+ This option can be set globally for all assets and individually for each asset
1219
+ package:
1220
+
1221
+ .. configuration-block ::
1222
+
1223
+ .. code-block :: yaml
1224
+
1225
+ # app/config/config.yml
1226
+ framework :
1227
+ assets :
1228
+ # this manifest is applied to every asset (including packages)
1229
+ json_manifest_path : " %kernel.project_dir%/web/assets/manifest.json"
1230
+ packages :
1231
+ foo_package :
1232
+ # this package uses its own manifest (the default file is ignored)
1233
+ json_manifest_path : " %kernel.project_dir%/web/assets/a_different_manifest.json"
1234
+ bar_package :
1235
+ # this package uses the global manifest (the default file is used)
1236
+ base_path : ' /images'
1237
+
1238
+ .. code-block :: xml
1239
+
1240
+ <!-- app/config/config.xml -->
1241
+ <?xml version =" 1.0" encoding =" UTF-8" ?>
1242
+ <container xmlns =" http://symfony.com/schema/dic/services"
1243
+ xmlns : xsi =" http://www.w3.org/2001/XMLSchema-instance"
1244
+ xmlns : framework =" http://symfony.com/schema/dic/symfony"
1245
+ xsi : schemaLocation =" http://symfony.com/schema/dic/services http://symfony.com/schema/dic/services/services-1.0.xsd
1246
+ http://symfony.com/schema/dic/symfony http://symfony.com/schema/dic/symfony/symfony-1.0.xsd" >
1247
+
1248
+ <framework : config >
1249
+ <framework : assets json_manifest_path =" %kernel.project_dir%/web/assets/manifest.json" >
1250
+ <!-- this package removes the manifest (the file will not apply) -->
1251
+ <framework : package
1252
+ name =" foo_package"
1253
+ json_manifest_path =" %kernel.project_dir%/web/assets/a_different_manifest.json" />
1254
+ <!-- this package uses the global manifest (the default file is used) -->
1255
+ <framework : package
1256
+ name =" bar_package"
1257
+ base_path =" /images" />
1258
+ </framework : assets >
1259
+ </framework : config >
1260
+ </container >
1261
+
1262
+ .. code-block :: php
1263
+
1264
+ // app/config/config.php
1265
+ $container->loadFromExtension('framework', array(
1266
+ 'assets' => array(
1267
+ 'json_manifest_path' => '%kernel.project_dir%/web/assets/manifest.json',
1268
+ 'packages' => array(
1269
+ 'foo_package' => array(
1270
+ // this package uses its own manifest (the default file is ignored)
1271
+ 'json_manifest_path' => '%kernel.project_dir%/web/assets/a_different_manifest.json',
1272
+ ),
1273
+ 'bar_package' => array(
1274
+ // this package uses the global manifest (the default file is used)
1275
+ 'json_manifest_path' => '/images',
1276
+ ),
1277
+ ),
1278
+ ),
1279
+ ));
1280
+
1281
+ .. note ::
1282
+
1283
+ This parameter cannot be set at the same time as ``version `` or ``version_strategy ``.
1284
+ Additionally, this option cannot be nullified at the package scope if a global manifest
1285
+ file is specified.
1286
+
1287
+ .. tip ::
1288
+
1289
+ If you request an asset that is *not found * in the ``manifest.json `` file, the original -
1290
+ *unmodified * - asset path will be returned.
1191
1291
1192
1292
templating
1193
1293
~~~~~~~~~~
@@ -1901,3 +2001,5 @@ Full Default Configuration
1901
2001
.. _`PhpStormProtocol` : https://github.com/aik099/PhpStormProtocol
1902
2002
.. _`phpstorm-url-handler` : https://github.com/sanduhrs/phpstorm-url-handler
1903
2003
.. _`blue/green deployment` : http://martinfowler.com/bliki/BlueGreenDeployment.html
2004
+ .. _`gulp-rev` : https://www.npmjs.com/package/gulp-rev
2005
+ .. _`webpack-manifest-plugin` : https://www.npmjs.com/package/webpack-manifest-plugin