@@ -274,10 +274,12 @@ protected function _requireInlineJs($javascript, ?array $options = [], int $prio
274274 *
275275 * @param bool $allowComponentBubble If the resource does not exist in a component, attempt to load from its parent
276276 *
277+ * @param null $flags
278+ *
277279 * @return string|null
278- * @throws Exception
280+ * @throws \ReflectionException
279281 */
280- public function getResourceUri ($ relativeFullPath , bool $ allowComponentBubble = true ): ?string
282+ public function getResourceUri ($ relativeFullPath , bool $ allowComponentBubble = true , $ flags = null ): ?string
281283 {
282284 if ($ this ->_type == self ::MAP_EXTERNAL || $ this ->isExternalUrl ($ relativeFullPath ))
283285 {
@@ -303,6 +305,10 @@ public function getResourceUri($relativeFullPath, bool $allowComponentBubble = t
303305 $ hash = $ this ->getFileHash ($ filePath );
304306
305307 $ bits = Dispatch::instance ()->getBits ();
308+ if ($ flags !== null )
309+ {
310+ $ bits = BitWise::add ($ bits , $ flags );
311+ }
306312
307313 if (!$ hash )
308314 {
@@ -323,7 +329,7 @@ protected function _optimisePath($path, $relativeFullPath)
323329 $ this ->_optimizeWebP = ValueAs::bool (Dispatch::instance ()->config ()->getItem ('optimisation ' , 'webp ' , false ));
324330 }
325331
326- if ($ this ->_optimizeWebP && BitWise::has (($ this ->_dispatch ?: Dispatch::instance ())->getBits (), Dispatch::BIT_WEBP )
332+ if ($ this ->_optimizeWebP && BitWise::has (($ this ->_dispatch ?: Dispatch::instance ())->getBits (), Dispatch::FLAG_WEBP )
327333 && in_array (substr ($ path , -4 ), ['.jpg ' , 'jpeg ' , '.png ' , '.gif ' , '.bmp ' , 'tiff ' , '.svg ' ])
328334 && file_exists ($ path . '.webp ' ))
329335 {
0 commit comments