@@ -41,6 +41,7 @@ Configuration
4141 * `base_urls `_
4242 * `json_manifest_path `_
4343 * `packages `_
44+ * `strict `_
4445 * `version_format `_
4546 * `version_strategy `_
4647 * `version `_
@@ -1842,6 +1843,7 @@ Each package can configure the following options:
18421843* :ref: `version <reference-framework-assets-version >`
18431844* :ref: `version_format <reference-assets-version-format >`
18441845* :ref: `json_manifest_path <reference-assets-json-manifest-path >`
1846+ * :ref: `strict <reference-assets-strict >`
18451847
18461848.. _reference-framework-assets-version :
18471849.. _ref-framework-assets-version :
@@ -2084,6 +2086,8 @@ package:
20842086 foo_package :
20852087 # this package uses its own manifest (the default file is ignored)
20862088 json_manifest_path : " %kernel.project_dir%/public/build/a_different_manifest.json"
2089+ # for debug, an exception is thrown when an asset is not found in the manifest
2090+ strict : " %kernel.debug%"
20872091 bar_package :
20882092 # this package uses the global manifest (the default file is used)
20892093 base_path : ' /images'
@@ -2104,9 +2108,11 @@ package:
21042108 <!-- you can use absolute URLs too and Symfony will download them automatically -->
21052109 <!-- <framework:assets json-manifest-path="https://cdn.example.com/manifest.json"> -->
21062110 <!-- this package uses its own manifest (the default file is ignored) -->
2111+ <!-- for debug, an exception is thrown when an asset is not found in the manifest -->
21072112 <framework : package
21082113 name =" foo_package"
2109- json-manifest-path =" %kernel.project_dir%/public/build/a_different_manifest.json" />
2114+ json-manifest-path =" %kernel.project_dir%/public/build/a_different_manifest.json"
2115+ strict =" true" />
21102116 <!-- this package uses the global manifest (the default file is used) -->
21112117 <framework : package
21122118 name =" bar_package"
@@ -2128,6 +2134,8 @@ package:
21282134 'foo_package' => [
21292135 // this package uses its own manifest (the default file is ignored)
21302136 'json_manifest_path' => '%kernel.project_dir%/public/build/a_different_manifest.json',
2137+ // for debug, an exception is thrown when an asset is not found in the manifest
2138+ 'strict' => '%kernel.debug%',
21312139 ],
21322140 'bar_package' => [
21332141 // this package uses the global manifest (the default file is used)
@@ -2152,11 +2160,21 @@ package:
21522160
21532161 If you request an asset that is *not found * in the ``manifest.json `` file, the original -
21542162 *unmodified * - asset path will be returned.
2163+ Set `strict ` to `true ` to get an exception when an asset is *not found *.
21552164
21562165.. note ::
21572166
21582167 If an URL is set, the JSON manifest is downloaded on each request using the `http_client `_.
21592168
2169+ strict
2170+ ......
2171+
2172+ **type **: ``boolean `` **default **: ``false ``
2173+
2174+ .. versionadded :: 5.2
2175+
2176+ This option was introduced in Symfony 5.2.
2177+
21602178translator
21612179~~~~~~~~~~
21622180
0 commit comments