Speed Optimizer minification incompatibility

Hello!
We’re aware that you follow the guidelines and if understand right, are already minifying files. Speed Optimizer seems to re-minify some of your files and causes JS errors:


(the last error about lottie isn’t related, it remains when minifying is gone)

These files don’t seem to be available when trying to exclude them:

SG suggested we add custom excludes, which I guess would be the right way to deal with this.

add_filter( 'sgo_js_minify_exclude', 'js_minify_exclude' );
function js_minify_exclude( $exclude_list ) {
  $exclude_list[] = 'script-handle';
  $exclude_list[] = 'script-handle-2';

  return $exclude_list;
}

How can we find (or can you provide) the script handles we’d have to exclude?
Would “cs-sliders.min.js” be excluded if we add the handle “cs-sliders”?

If you already have an exclude list about this, it’d be awesome!

Hey Magik,

Thanks for reaching out!

Optimization plugins like Siteground Optimizer often combine scripts and reorder them and the common cause of issues as some scripts should not be combined, minified nor re-ordered. That is the case with our products, you need to exclude everything from Pro from any kind of optimization. Don’t worry, our themes are optimized out of the box so they don’t need third-party optimization.

Hope that helps.

1 Like

Thank you @marc_a, this helps!
We do want to exclude the files and want to know how we could find the “script handles” so that we can feed Speed Optimizer’s custom exclude filter since we can’t select all of Pro’s files directly from their backend.

Especially the ones used in Cornerstone, because it breaks it (like cs-sliders.min.js).
If you have a list of all of your files / the handles so we can exclude them all, we will!

Thank you for your patience and help! :slight_smile:

Hey @magikweb,

Regretfully, we don’t have a list of all files. Most optimization systems do have a catch all method. Please reach out to SG support to exclude all JS files under themes/pro. It’s usually done in REGEX like themes/pro/*.js

SG helped us, for the time-being, the solution is to add this filter:

// Pro already-minified files Speed Optimizer breaks
add_filter( 'sgo_js_minify_exclude', 'js_minify_exclude' );
function js_minify_exclude( $exclude_list ) {
	$exclude_list[] = 'cs-sliders';
	$exclude_list[] = 'cs-graphql';
	$exclude_list[] = 'cs-text-type';
	
	return $exclude_list;
}

If anyone knows of other files that should be excluded, let us know so we can update that filter.

Hey @magikweb,

We’re glad that SG we’re able to help you with your issue.

Cheers!

This topic was automatically closed 10 days after the last reply. New replies are no longer allowed.