gantry / gantry5

:rocket: Next Generation Template / Theme Framework
http://gantry.org
1.03k stars 204 forks source link

New WordPress update is not working well with Litespeed Cache plugin!!! #2976

Closed Mohika closed 2 years ago

Mohika commented 2 years ago

New WordPress update is not working well with Litespeed Cache plugin!!!

Submenu not showing and causing JS error if JS is minified by the LiteSpeed Cache plugin

Uncaught SyntaxError: Invalid regular expression flags

var verbs=/^constructor|inherits|mixin$/var implement=function(proto){var prototype=this.prototype

mahagr commented 2 years ago

Looks like the cache plugin generates bad JS. As the code is valid in Gantry, the issue is in the Litespeed plugin.

mahagr commented 2 years ago

BTW, we just recompiled the JS, which may have caused the issue. But basically I never use any JS compression plugins because of they tend to break some code now and then, causing random issues which are hard to track.

In your case the compression fails to understand how regular expressions are written in JS and combines two assignments to one -- thus breaking the code.

Mohika commented 2 years ago

Then you don't know much about today's SEO. It's simply mandatory to use caching plugins.

Older versions of the Gantry do not break JS code. This is I am afraid if you don't do anything about it the huge downfall of the Gantry 5 framework.

mahagr commented 2 years ago

What can I say? The plugin you use generates broken JS code due to a bug in it. This is not the first time something like that happens, minimizer plugins sometimes break js and css due to bugs they have in their minimize methods.

The code that breaks is a node module not written by us and not updated since Gantry 5.5.0. The code is also perfectly valid until Litespeed minimizes and breaks it by removing too many newline/space characters.

Generally these issues have been pretty random; recompiling the code in a different computer can fix it, but the issue may come back at any time -- usually breaking something else, or in someone elses site. Even the other JS in your page may cause things to either work or break and the issues have nothing to do with Gantry -- it can happen with any code (I've seen it in Grav, Joomla and WP, with and without Gantry).

I would report the issue to the Litespeed minimizer code, as it seems to have a bug in it which causes it to output bad code in some instances.

Mohika commented 2 years ago

If I just revert back to the old version of the Gantry5 plugin code is complied without the error. It's not random and I have tested it it happens with the new plugin update on any website. You may say what you will as usual.