Skip to content

Commit

Permalink
Identify min vers of assets that reside outside of the $relative_asse…
Browse files Browse the repository at this point in the history
…t_path
  • Loading branch information
dpanta94 committed Jun 5, 2024
1 parent c5cbed2 commit 8d831fb
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion src/Assets/Asset.php
Original file line number Diff line number Diff line change
Expand Up @@ -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 ) {
Expand Down

0 comments on commit 8d831fb

Please sign in to comment.