@@ -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 `_
@@ -1933,6 +1934,7 @@ Each package can configure the following options:
1933
1934
* :ref: `version <reference-framework-assets-version >`
1934
1935
* :ref: `version_format <reference-assets-version-format >`
1935
1936
* :ref: `json_manifest_path <reference-assets-json-manifest-path >`
1937
+ * :ref: `strict_mode <reference-assets-strict-mode >`
1936
1938
1937
1939
.. _reference-framework-assets-version :
1938
1940
.. _ref-framework-assets-version :
@@ -2175,6 +2177,8 @@ package:
2175
2177
foo_package :
2176
2178
# this package uses its own manifest (the default file is ignored)
2177
2179
json_manifest_path : " %kernel.project_dir%/public/build/a_different_manifest.json"
2180
+ # for debug, an exception is thrown when an asset is not found in the manifest
2181
+ strict_mode : " %kernel.debug%"
2178
2182
bar_package :
2179
2183
# this package uses the global manifest (the default file is used)
2180
2184
base_path : ' /images'
@@ -2195,9 +2199,11 @@ package:
2195
2199
<!-- you can use absolute URLs too and Symfony will download them automatically -->
2196
2200
<!-- <framework:assets json-manifest-path="https://cdn.example.com/manifest.json"> -->
2197
2201
<!-- this package uses its own manifest (the default file is ignored) -->
2202
+ <!-- for debug, an exception is thrown when an asset is not found in the manifest -->
2198
2203
<framework : package
2199
2204
name =" foo_package"
2200
- json-manifest-path =" %kernel.project_dir%/public/build/a_different_manifest.json" />
2205
+ json-manifest-path =" %kernel.project_dir%/public/build/a_different_manifest.json"
2206
+ strict-mode =" true" />
2201
2207
<!-- this package uses the global manifest (the default file is used) -->
2202
2208
<framework : package
2203
2209
name =" bar_package"
@@ -2219,6 +2225,8 @@ package:
2219
2225
'foo_package' => [
2220
2226
// this package uses its own manifest (the default file is ignored)
2221
2227
'json_manifest_path' => '%kernel.project_dir%/public/build/a_different_manifest.json',
2228
+ // for debug, an exception is thrown when an asset is not found in the manifest
2229
+ 'strict_mode' => '%kernel.debug%',
2222
2230
],
2223
2231
'bar_package' => [
2224
2232
// this package uses the global manifest (the default file is used)
@@ -2243,11 +2251,23 @@ package:
2243
2251
2244
2252
If you request an asset that is *not found * in the ``manifest.json `` file, the original -
2245
2253
*unmodified * - asset path will be returned.
2254
+ Set `strict_mode ` to `true ` to get an exception when an asset is *not found *.
2246
2255
2247
2256
.. note ::
2248
2257
2249
2258
If an URL is set, the JSON manifest is downloaded on each request using the `http_client `_.
2250
2259
2260
+ .. _reference-assets-strict-mode :
2261
+
2262
+ strict_mode
2263
+ ...........
2264
+
2265
+ **type **: ``boolean `` **default **: ``false ``
2266
+
2267
+ .. versionadded :: 5.3
2268
+
2269
+ This option was introduced in Symfony 5.3.
2270
+
2251
2271
translator
2252
2272
~~~~~~~~~~
2253
2273
0 commit comments