• 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:

    myserver.com/wp-content/plugins/live-comment-preview/live-comment-preview.js

    instead of:
    myserver.com/?live-comment-preview.js

    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:

    server.com/wp-content/plugins/live-comment-preview/live-comment-preview.js?ver=1.9

    best regards

    Fernando

Viewing 3 replies - 1 through 3 (of 3 total)
  • It can be packed using http://dean.edwards.name/packer/

    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’);

    to:

    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:
    http://compressorrater.thruhere.net/

    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.