In W3TC, setting JS embeds to defer breaks JQuery- J

As above. Using W3TC, I’m trying to defer parsing of JS:

But, in console, I get a “JQuery is not defined” error, and some site elements don’t work- things like tabs, accordions etc.

Here’s my current config: https://pastebin.com/ADhtXqhM

Any ideas what I need to change to ensure that my site functions correctly?

Hi @liquidedge,

Please exclude these js files from minification

If using PRO

wp-content/themes/pro/cornerstone/assets/dist/js/site/cs-body.js
wp-content/themes/pro/cornerstone/assets/dist/js/site/cs-head.js
wp-content/themes/pro/cornerstone/assets/dist/js/site/cs-vendor.js
wp-content/themes/pro/cornerstone/assets/dist/js/site/cs.js
wp-content/themes/pro/framework/dist/js/site/x.js

If using X

wp-content/plugins/cornerstone/assets/dist/js/site/cs-body.js
wp-content/plugins/cornerstone/assets/dist/js/site/cs-head.js
wp-content/plugins/cornerstone/assets/dist-app/js/cs-vendor.js
wp-content/plugins/cornerstone/assets/dist-app/js/cs.js
wp-content/themes/pro/framework/dist/js/site/x.js

No need to minify these files as they are minified by default

Thanks

Thanks Paul- If using X though you’ve got a reference to Pro in there.

However, I’m still getting errors:

Any idea how I can solve that?

Hi,

Sorry about that, please change wp-content/themes/pro/framework/dist/js/site/x.js with wp-content/themes/x/framework/dist/js/site/x.js

Deferring any javascript will affect the loading order of the scripts, sometimes, the dependencies or libraries are loaded late than the script requiring it, hence, all scripts fail.

I am sorry but website optimization is outside the scope of support. You will need to consult with a developer with this,

Thank you for understanding.

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