@@ -41,6 +41,7 @@ Configuration
41
41
* `base_urls `_
42
42
* `json_manifest_path `_
43
43
* `packages `_
44
+ * `strict_mode `_
44
45
* `version_format `_
45
46
* `version_strategy `_
46
47
* `version `_
@@ -1926,6 +1927,7 @@ Each package can configure the following options:
1926
1927
* :ref: `version <reference-framework-assets-version >`
1927
1928
* :ref: `version_format <reference-assets-version-format >`
1928
1929
* :ref: `json_manifest_path <reference-assets-json-manifest-path >`
1930
+ * :ref: `strict_mode <reference-assets-strict-mode >`
1929
1931
1930
1932
.. _reference-framework-assets-version :
1931
1933
.. _ref-framework-assets-version :
@@ -2168,6 +2170,8 @@ package:
2168
2170
foo_package :
2169
2171
# this package uses its own manifest (the default file is ignored)
2170
2172
json_manifest_path : " %kernel.project_dir%/public/build/a_different_manifest.json"
2173
+ # for debug, an exception is thrown when an asset is not found in the manifest
2174
+ strict_mode : " %kernel.debug%"
2171
2175
bar_package :
2172
2176
# this package uses the global manifest (the default file is used)
2173
2177
base_path : ' /images'
@@ -2188,9 +2192,11 @@ package:
2188
2192
<!-- you can use absolute URLs too and Symfony will download them automatically -->
2189
2193
<!-- <framework:assets json-manifest-path="https://cdn.example.com/manifest.json"> -->
2190
2194
<!-- this package uses its own manifest (the default file is ignored) -->
2195
+ <!-- for debug, an exception is thrown when an asset is not found in the manifest -->
2191
2196
<framework : package
2192
2197
name =" foo_package"
2193
- json-manifest-path =" %kernel.project_dir%/public/build/a_different_manifest.json" />
2198
+ json-manifest-path =" %kernel.project_dir%/public/build/a_different_manifest.json"
2199
+ strict-mode =" true" />
2194
2200
<!-- this package uses the global manifest (the default file is used) -->
2195
2201
<framework : package
2196
2202
name =" bar_package"
@@ -2212,6 +2218,8 @@ package:
2212
2218
'foo_package' => [
2213
2219
// this package uses its own manifest (the default file is ignored)
2214
2220
'json_manifest_path' => '%kernel.project_dir%/public/build/a_different_manifest.json',
2221
+ // for debug, an exception is thrown when an asset is not found in the manifest
2222
+ 'strict_mode' => '%kernel.debug%',
2215
2223
],
2216
2224
'bar_package' => [
2217
2225
// this package uses the global manifest (the default file is used)
@@ -2236,11 +2244,21 @@ package:
2236
2244
2237
2245
If you request an asset that is *not found * in the ``manifest.json `` file, the original -
2238
2246
*unmodified * - asset path will be returned.
2247
+ Set `strict_mode ` to `true ` to get an exception when an asset is *not found *.
2239
2248
2240
2249
.. note ::
2241
2250
2242
2251
If an URL is set, the JSON manifest is downloaded on each request using the `http_client `_.
2243
2252
2253
+ strict_mode
2254
+ ...........
2255
+
2256
+ **type **: ``boolean `` **default **: ``false ``
2257
+
2258
+ .. versionadded :: 5.2
2259
+
2260
+ This option was introduced in Symfony 5.2.
2261
+
2244
2262
translator
2245
2263
~~~~~~~~~~
2246
2264
0 commit comments