Slider not loading/showing with W3 Total Cache Minify turned on

lee's Avatar

lee

04 Apr, 2018 02:35 PM

I have just installed the W3 Total Cache plugin, and have turned on Minify to Auto, and set the JS to load as non-blocking, but no matter what option I choose, the slider never shows up. I just see the grey screen, with the console showing:

Uncaught ReferenceError: jQuery is not defined

I load my JS files in the footer for better loading. I suspect I need to set the depency of RS JS to look for 'jquery'. How can I do this?

  1. Support Staff 1 Posted by Dmitry Semenov on 04 Apr, 2018 05:52 PM

    Dmitry Semenov's Avatar

    Hello,

    The slider already has dependency set to jQuery, so I don't think that you should set it anywhere else.

    Do you have the same issue when using with default theme and no other plugins (besides w3 cache)?

    Slider JS code is already minified, and it's loaded in the footer of the page, so it doesn't block rendering.

    Dmitry

  2. 2 Posted by lee on 05 Apr, 2018 07:56 AM

    lee's Avatar

    I can't test like that right now, it's a clients website in a live
    production environment. I Would need to set up a development site for that.

    But anyway, the JS for royalslider is inline script, rather than enqueued
    in Wordpress in a JS file. Why is this? Wouldn't this make it easier for it
    to be picked up by W3 Total Cache if it were properly enqueued?

    Considering that there are quite a few people who have this exact same
    issue, I'm surprised you haven't actually changed the way the plugin deals
    with it's JS Files to make it more compatible with WTC, as I would imagine
    it's a very popular request right now.

    Can you tell me how you've managed to get your experiences of the two
    working fine whilst fully minified?

  3. Support Staff 3 Posted by Dmitry Semenov on 05 Apr, 2018 11:23 AM

    Dmitry Semenov's Avatar

    The plugin already uses default WordPress method to include files and it's already fully optimized, you don't need to apply any actions to it.

    If you need to use W3 Total Cache to optimize other resources - you may exclude slider JS file from its minifications. W3 Total Cache has an option "Never minify the following JS files" which allows excluding any resource.

  4. 4 Posted by lee on 05 Apr, 2018 12:35 PM

    lee's Avatar

    So you're saying that nothing can be done? No wonder there are several
    people with the same problem, it doesn't sound like you're really helping
    to fix the problem, if you don't mind me saying.

    Your plugin is using inline javascript in the footer, which is bad, and
    hsould be contained in JS Files and properly enqueued. This is the reason
    that W3 Total Cache can't pickup your JS code and arrange it accordingly.

    I'll ask again, can you please tell me how you've managed to get your
    experiences of the two working fine whilst fully minified?

  5. Support Staff 5 Posted by Dmitry Semenov on 05 Apr, 2018 12:51 PM

    Dmitry Semenov's Avatar

    Your plugin is using inline javascript in the footer, which is bad

    It is dynamic initialization code that depends on options and content of the page and slider. The alternative is to dynamically generate JS file, which is worse than inlining two lines of JS.

    it doesn't sound like you're really helping to fix the problem, if you don't mind me saying.

    I added the clarification to the previous message, please view it on forum if you've missed it http://help.dimsemenov.com/discussions/royalslider-wordpress/47076-...

Reply to this discussion

Internal reply

Formatting help / Preview (switch to plain text) No formatting (switch to Markdown)

Attaching KB article:

»

Attached Files

You can attach files up to 10MB

If you don't have an account yet, we need to confirm you're human and not a machine trying to post spam.

Keyboard shortcuts

Generic

? Show this help
ESC Blurs the current field

Comment Form

r Focus the comment reply box
^ + ↩ Submit the comment

You can use Command ⌘ instead of Control ^ on Mac