diff --git a/src/Assets/Asset.php b/src/Assets/Asset.php index 3b06837..89346d4 100644 --- a/src/Assets/Asset.php +++ b/src/Assets/Asset.php @@ -927,7 +927,11 @@ public function maybe_get_min_file( $url ) { substr( $relative_location, -3, 3 ) === '.js' || substr( $relative_location, -4, 4 ) === '.css' ) { - $urls[] = preg_replace( '#(.*)(' . preg_quote( $relative_asset_path, '#' ) . ')(.*[a-zA-Z0-0\-\_\.]+).(js|css)#', '$1' . $min_asset_path . '$3.min.$4', $relative_location ); + if ( $min_asset_path !== $relative_asset_path ) { + $urls[] = preg_replace( '#(.*)(' . preg_quote( $relative_asset_path, '#' ) . ')(.*[a-zA-Z0-0\-\_\.]+).(js|css)#', '$1' . $min_asset_path . '$3.min.$4', $relative_location ); + } else { + $urls[] = preg_replace( '#(.*).(js|css)#', '$1.min.$2', $relative_location ); + } } if ( ! $script_debug ) {