Navigation
This is archived content. Visit our new forum.
  • Author
    Posts
  • #21328

    James R
    Participant

    If I use Better Wordpres Minify to minify js and css, I start getting these errors:
    Uncaught ReferenceError: jQuery is not defined ... jquery.themepunch.plugins.min.js?rev=4.1.4&ver=3.8.1:51

    BWP can move theme into the bottom of the body, but only if I know the js handle used in the wp_enqueue_script call.

    But before I dug into the code, I thought I’d pick your brain.
    – Does Revolution slider have a way to make it initialize later?
    – Can you tell me what the handles are that you use for the themepunch file enqueuing so I can try that in BWP?
    – Shouldn’t there be a dependency on the ‘jquery’ script handle so it doesn’t output these lines until jaquery has been output (maybe BWP is messing with this – I don’t know)
    – the revolution slider scripts are being output unminified. does this mean you are not using enqueue script? is there a hook I can implement to enqueue these my own way?

    Sorry for all the questions … just brainstorming on possible solutions. Thanks!

    #21370

    Rubin
    Keymaster

    Hey There,

    we can’t provide support for 3rd party plugins since there are simply too many out there and we can’t test them all sorry. jQuery gets enqueued in the header as one of the few javascript that go there. The rest is in the footer.

    #21468

    James R
    Participant

    but revolution slider is packaged with your theme … so if you told me a little about how you enqueue those files, i could provide some insight on how to make your theme work with Better WordPress Minify.

    it’s ok. i’ll just dig into your theme files and figure it out myself.

    #21476

    James R
    Participant

    OK so I found the code that messes up the Revolution slider when you are using a minification plugin, and oddly enough, they have the PROPER code also in that block, but it’s mysteriously commented out.

    Here’s the relevant code in the revslider_front.php file:

    self::addScript("jquery.themepunch.plugins.min","rs-plugin/js",'themepunchtools');
    self::addScript("jquery.themepunch.revolution.min","rs-plugin/js");
    //self::addScriptWaitFor("jquery.themepunch.plugins.min","rs-plugin/js",'themepunchtools', array('jquery'));
    //self::addScriptWaitFor("jquery.themepunch.revolution.min","rs-plugin/js", null, array('jquery'));

    And all I had to do was comment out the two lines above, and uncomment the two lines below.

    And to answer my other question, the first themepunch file has a handle of ‘themepunchtools’, and the second, again, myseteriosly, does not have a handle, which, I personally, think is stupid.

    The difference between these line of code is that the second two lines properly cite the jquery dependency. That’s all that’s need in order for any other plugin to properly include those files the correct way. The other thing you have to do is suppress the JS Include to the body via the setting on the slider under Troubleshooting.

    Happy to give to give visuals if needed.

    #21481

    Andrea G
    Participant

    good job, txs for doing all this research in case someone needs to work with minify

    #21494

    James R
    Participant

    welcome πŸ™‚

    #21515

    James R
    Participant

    More tips on Revolution Slider:

    • if you use all the default settings, it’s including the JS files TWICE, once in the HEAD, once before the close BODY tag. not cool. no offense to the X theme. this is how the slider plugin works. to fix this, go to Revolution Slider > Global Settings > Put JS Includes To Footer to β€œON.” this will only include the JS in the footer,, which should be fine.
    • if you leave all the default settings, it’s adding the RevSlider code to EVERY PAGE on your site. For many sites, this is unnecessary. to fix: go to Revolution Slider > Global Settings > Include RevSlider libraries globally, set to “OFF”, then below, include the page ids or slugs that actually use the slider. it’s a pain in the ass but these are fairly bulky JS files, even minified, weighing in around 150K.
    • each actual slider you define also has some stuff under the troubleshooting accordion that you should look at. for best performance, set “Put JS includes to body” to “False” (yes, they actually try to include these damn files up to THREE TIMES). not yet sure what the noConflict and Output filters Protection settings have. I know in theory, but without testing, I can’t say for sure. this plugin has some weird behaviors and coding.

    And a note: I erroneously reported that by tweaking the code in revslider_front.php that it would make this work with Minify plugins. That’s not exactly true. Tweaking the code makes the scripts AT LEAST wait for jQuery to be loaded (eliminating a JS error), but for some reason, it still doesn’t let BWP put it in a Minify string. Not sure why yet. They seem to be doing everything the normal way.

    #21539

    James R
    Participant

    FYI I had to make a bunch of changes to the Revolution Slider classes in order to make it play nice with the Minification plugin. They use some odd coding conventions that break compatibility with minify. See http://codecanyon.net/item/slider-revolution-responsive-jquery-plugin/2580848/comments?page=42&filter=all#comment_6125245 for full details on my recommendations and if anyone needs the code edits, please let me know.

    #21659

    Christian
    Moderator

    Hey James,

    Thanks for your tips. πŸ™‚

    #21719

    James R
    Participant

    Is there a way for us to obtain updates to Revolution Slider? They are on version 4.2.3 and have fixed many of these issues.

    #21814

    Rubin
    Keymaster

    We will add the latest version of Revolution Slider in our next update. Promise! πŸ™‚

    #300067

    Omri B
    Participant

    You rock James. Thanks mate.
    And to the Themeco team too of course.

    #300489

    Friech
    Moderator

    Hey There,

    Im glad this post is still helpful even though its too old, the current Revslider version that is bundled with X v4.0.1 is the Revslider v4.6.93

    Cheers!