Support » Plugins » [Plugin: Live Comment Preview] Caching the JS script

  • Hi! and congratulations for this plugin!

    I’m caching in client side all static files as JS scripts for server performance and better user experience.

    I would like to know if you are considering (or it’s possible) to include the JS script for your plugin in a ‘regular’ cacheable way like:

    instead of:

    could save 13KB’s on every page load (or 4 KB if gzipped)

    also including the version number as many other plugins do is a good idea as it will invalidate the client side cached version:

    best regards


Viewing 3 replies - 1 through 3 (of 3 total)
  • It can be packed using

    The javascript for this plugin is a little tricky because it is generated dynamically and customized by a function in live-comment-preview.php. That’s why it’s called with the query ?live-comment-preview.js. I was looking into forcing it to cache in the browser but I think that may break the way the gravatar IDs are generated dynamically. Making the entire javascript static looked like a lot more hacking than I was willing to try.

    I was able to generate a gzipped file by changing line 72 from:

    header(‘Content-type: text/javascript’);


    ob_start (“ob_gzhandler”); //compress with gzip if possible
    header(‘Content-type: text/javascript’);

    This reduces the javascript file size from 13.4KB to 4.4KB.

    Oh, as a side note, the md5.js file can be minified to save a few K. I was just doing some research and this site looks interesting:

    You can compare the compression of four different javascript compressors (before and after gzip).

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘[Plugin: Live Comment Preview] Caching the JS script’ is closed to new replies.