WordPress.org

Forums

W3 Total Cache
[resolved] Inline JS minification breaks Shareaholic (7 posts)

  1. kensho
    Member
    Posted 1 year ago #

    Hi all,

    We recently built a charity website that makes use of both W3TC and Shareaholic plugins (both the latest versions). When we activated and configured W3TC, we noticed our Shareaholic social icons had disappeared from our pages. (They were working correctly and consistently before activating W3TC).

    After thorough troubleshooting, we isolated the cause: enabling inline JS minification in W3TC.

    Entering the Shareaholic script names in the "Never minify the following JS files" field makes no difference. Disabling inline JS minification in W3TC restores the Shareaholic display to normal.

    http://wordpress.org/plugins/w3-total-cache/

  2. nasca
    Member
    Posted 1 year ago #

    JS minification doesn't bode well with a lot of JS libraries. Since the gains from JS minification are minimal it's better to leave it off.

  3. kensho
    Member
    Posted 1 year ago #

    Yeah, JS minification can be really tricky, but sometimes worthwhile for script-heavy sites hosted on slow servers. In this case, we did minify most of our JS, which shaved about 3 seconds off of average page load times when using W3TC. Our only issue on this site was with inline JS minification, and that too only with Shareaholic.

    But we don't particularly need inline JS minification on this site because we didn't use much inline JS (just a few short scripts that are annoyingly inserted inline by plugins instead of using external scripts).

    So. this post was meant as a headsup for those who might be affected, hopefully to save them some troubleshooting time. (But of course if the devs of either Shareaholic or W3TC can find a fix, all the better for those who wish to use inline JS minification.)

    Actually, in the end, after configuring W3TC to its optimum settings and testing page load times, we then deactivated W3TC and set up WP Super Cache to do a comparison, since every site and host context is different and you never know. The result: WP Super Cache resulted in page loads that were 2-3 times as fast as with the best W3TC settings. So, while one sometimes gets better results with W3TC, for this site we wound up going with WP Super Cache. Moral of the story: It's worth testing both if performance matters.

  4. Shareaholic
    Member
    Posted 1 year ago #

    @kensho I'm glad you got everything to work. Rest assured, all Shareaholic code already comes appropriately minified and is also served from premium CDNs for speedy delivery.

  5. kensho
    Member
    Posted 1 year ago #

    @Shareaholic,

    Thanks for your note. Yes, Shareaholic's scripts are minified but they aren't combined. It adds 4 external scripts, which is inefficient because it's 4 http requests instead of one, and more DNS lookups. All of this contributes to slowing a site down. If it's just one plug-in that does this sort of thing, maybe it doesn't make a huge difference, but when several do it, it adds up fast.

    It would be much better for page load times (and therefore for SEO) if Shareaholic would combine all of its scripts into one minified script (and same with CSS, of course).

    Also, you might want to coordinate with the developer of W3TC to figure out why W3TC's inline JS minification is breaking Shareaholic and fix that, so that your users aren't forced to choose between Shareaholic and inline JS minification (which they might need for their *other* scripts, but if it breaks Shareaholic they can't turn it on for *any* of their scripts — that's the case now).

    Thanks for your consideration.

  6. Shareaholic
    Member
    Posted 1 year ago #

    @kensho grab the latest version of Shareaholic when you get a minute - it fixes the issue with inline JS minification. Thanks so much for the heads up!

    http://wordpress.org/plugins/shareaholic/changelog/

  7. kensho
    Member
    Posted 1 year ago #

    @Shareaholic — Awesome, thanks. I can confirm that the issue is resolved for my client with the update. :-)

Topic Closed

This topic has been closed to new replies.

About this Plugin

  • W3 Total Cache
  • Frequently Asked Questions
  • Support Threads
  • Reviews

About this Topic