The MU forums have moved to

Off loading static resources (like JS, CSS, etc) (3 posts)

  1. zappoman
    Posted 16 years ago #

    I'm curious if anyone has any tips on off loading static resources like Javascript, CSS, images and other resouces from the WordpressMU CORE into an external service like Amazon S3.

    I've actually already implemented a pretty good solution for moving the static resources of themes onto a different server, but I find the Admin system to be incredibly resource heavy, and I'd like to optimize some of these static resources.

    Has anyone attempted this? Any tips? Are there some obvious filters/actions that I should look for to implement the appropriate URL rewriting to?

  2. SteveAtty
    Posted 16 years ago #

    Its something I've though about a lot. The admin side of things does seem to be very heavy but I've not really looked into it very much

  3. zappoman
    Posted 16 years ago #

    I don't have anything working yet, but a little bit of reading through the code turned up two filters of interest...


    print_scripts_array filters an array that appears to just have the "token" name for the script in question, so for example it will be something like:

    [0] => prototype
    [1] => wp-ajax
    [2] => fat
    [3] => listman
    [4] => ajaxcat
    [5] => jquery
    [6] => scriptaculous-root
    [7] => scriptaculous-builder
    [8] => scriptaculous-effects
    [9] => scriptaculous-dragdrop
    [10] => scriptaculous-slider
    [11] => scriptaculous-controls
    [12] => scriptaculous

    This filter might be useful if you wanted to do something like use minify to munge all the scripts together. But one issue I see is that you don't have enough info to consturct a url from this. In order to do that you have to dive into the details of the script loader class and essentially implement a new version of print_scripts()... not exactly the cleanest Object Oriented thing to do.

    The second filter is a little more promising, it basically passes you the full URL to the script file. It will look something like this:


    So from here, you certainly could parse out the path, filename, and even the version, and reconstruct the URL to go to an external server like AWS-S3.

    With this you could basically parse the

About this Topic

  • Started 16 years ago by zappoman
  • Latest reply from zappoman