@@ -41,6 +41,7 @@ Configuration
4141 * `base_urls `_
4242 * `json_manifest_path `_
4343 * `packages `_
44+ * `strict_mode `_
4445 * `version_format `_
4546 * `version_strategy `_
4647 * `version `_
@@ -1926,6 +1927,7 @@ Each package can configure the following options:
19261927* :ref: `version <reference-framework-assets-version >`
19271928* :ref: `version_format <reference-assets-version-format >`
19281929* :ref: `json_manifest_path <reference-assets-json-manifest-path >`
1930+ * :ref: `strict_mode <reference-assets-strict-mode >`
19291931
19301932.. _reference-framework-assets-version :
19311933.. _ref-framework-assets-version :
@@ -2168,6 +2170,8 @@ package:
21682170 foo_package :
21692171 # this package uses its own manifest (the default file is ignored)
21702172 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%"
21712175 bar_package :
21722176 # this package uses the global manifest (the default file is used)
21732177 base_path : ' /images'
@@ -2188,9 +2192,11 @@ package:
21882192 <!-- you can use absolute URLs too and Symfony will download them automatically -->
21892193 <!-- <framework:assets json-manifest-path="https://cdn.example.com/manifest.json"> -->
21902194 <!-- 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 -->
21912196 <framework : package
21922197 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" />
21942200 <!-- this package uses the global manifest (the default file is used) -->
21952201 <framework : package
21962202 name =" bar_package"
@@ -2212,6 +2218,8 @@ package:
22122218 'foo_package' => [
22132219 // this package uses its own manifest (the default file is ignored)
22142220 '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%',
22152223 ],
22162224 'bar_package' => [
22172225 // this package uses the global manifest (the default file is used)
@@ -2236,11 +2244,21 @@ package:
22362244
22372245 If you request an asset that is *not found * in the ``manifest.json `` file, the original -
22382246 *unmodified * - asset path will be returned.
2247+ Set `strict_mode ` to `true ` to get an exception when an asset is *not found *.
22392248
22402249.. note ::
22412250
22422251 If an URL is set, the JSON manifest is downloaded on each request using the `http_client `_.
22432252
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+
22442262translator
22452263~~~~~~~~~~
22462264
0 commit comments