Skip to content
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 14 additions & 0 deletions projects/plugins/boost/app/lib/minify/class-concatenate-js.php
Original file line number Diff line number Diff line change
Expand Up @@ -188,6 +188,20 @@ public function do_items( $handles = false, $group = false ) {
}
}

// This is a workaround to get the type of the script without outputting it.
// Build the final version of the script tag (by running it through apply_filters)
// and then checking the type. If it's a module script,
// skip it, as modules can't be concatenated with other scripts.
$script_tag = '<script type="text/javascript" src="' . esc_url( $js_url ) . '"></script>';
$script_tag = apply_filters( 'script_loader_tag', $script_tag, $handle, $js_url );
$script_type = preg_match( '/<script type=(["\'])([^"\']+)\1/', $script_tag, $matches ) ? $matches[2] : 'text/javascript';
if ( 'module' === $script_type ) {
$do_concat = false;
if ( defined( 'WP_DEBUG' ) && WP_DEBUG ) {
printf( "\n<!-- No Concat JS %s => Module Script -->\n", esc_html( $handle ) );
}
}

/**
* Filter that allows plugins to disable concatenation of certain scripts.
*
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
Significance: patch
Type: fixed

Concatenate JS: Exclude scripts of type module from concatenation.
Loading