diff --git a/inc/Services/Assets.php b/inc/Services/Assets.php index 75c15640..30c02f91 100644 --- a/inc/Services/Assets.php +++ b/inc/Services/Assets.php @@ -131,8 +131,15 @@ public function stylesheet_uri( string $stylesheet_uri ): string { * @return string */ public function get_min_file( string $type ): string { + static $cache_data; + + if ( isset( $cache_data[ $type ] ) ) { + return $cache_data[ $type ]; + } + if ( empty( $type ) ) { - return ''; + $cache_data[ $type ] = ''; + return $cache_data[ $type ]; } if ( ! file_exists( \get_theme_file_path( '/dist/assets.json' ) ) ) { @@ -176,7 +183,9 @@ public function get_min_file( string $type ): string { return ''; } - return $file; + $cache_data[ $type ] = $file; + + return $cache_data[ $type ]; } /**