SitePoint Sponsor

User Tag List

Results 1 to 20 of 20
  1. #1
    SitePoint Addict
    Join Date
    Jun 2009
    Posts
    317
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Move JS into footer (wordpress)

    Hi,

    Am struggling with speed on my site getting a overall grade of F from Yslow..

    I read that moving JS into the footer can help this.. how would i go about it? I found a plugin that was supposed to do this but I don't think it works with wordpress 9 cause am still getting a F for Javascript :~

    Thanks

    www.leehughes.co.uk

  2. #2
    SitePoint Zealot
    Join Date
    Aug 2009
    Posts
    150
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Putting js in the bottom is not really the thing that I would start with.
    It's better to do first things that affect users of your site, such as combining js files, you currently have 27 different js files (plus css), and minifying them if possible. This will make your site load much quicker. If you can enable gzip conmpression on your server.
    After that you need to setup expire headers for js/css, since I don't think you modify them often.
    This will bump your load speed and your YSlow grade.

  3. #3
    SitePoint Addict
    Join Date
    Jun 2009
    Posts
    317
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    right ok..

    There is a minimise tool on firebug yes?

    Yes I have heard of GZIP and I have to do that via my server?
    Thanks

  4. #4
    SitePoint Zealot
    Join Date
    Aug 2009
    Posts
    150
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    For minifying you can use jsmin. Gzip should be enable on your server for specific request (like js/css files), if you have apache mod_deflate is the module for this.
    Expire headers you can write in apache (if you have linux host).
    Just to be clear you will need eventually to put as much js as possible into footer, since it will make additional improvements.

  5. #5
    SitePoint Addict
    Join Date
    Jun 2009
    Posts
    317
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Ok thanks..

    I have a vague idea about what you're on about.. I shall do my best :0

    Thanks

  6. #6
    SitePoint Addict
    Join Date
    Jun 2009
    Posts
    317
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Ahh crap. that jsmin is a windows based program.. am on mac

  7. #7
    SitePoint Zealot
    Join Date
    Aug 2009
    Posts
    150
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I don't know if you read it already, but you can click on category titles in YSlow and it will go to pages with description of each problem and some way to solve it.

  8. #8
    SitePoint Zealot
    Join Date
    Aug 2009
    Posts
    150
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I think you can get C source here and compile it on mac? not sure though
    http://www.crockford.com/javascript/jsmin.html

  9. #9
    SitePoint Zealot
    Join Date
    Aug 2009
    Posts
    150
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    on the same link there is java, php and other versions, I think you can use one of those on mac

  10. #10
    SitePoint Addict
    Join Date
    Jun 2009
    Posts
    317
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    yeah, that's beyond me lol

  11. #11
    SitePoint Zealot
    Join Date
    Aug 2009
    Posts
    150
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    you can try one of these online minifiers:
    http://jscompress.com/ or http://fmarcia.info/jsmin/test.html

  12. #12
    SitePoint Addict
    Join Date
    Jun 2009
    Posts
    317
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Ahh that's better

    Thanks

  13. #13
    I meant that to happen silver trophybronze trophy Raffles's Avatar
    Join Date
    Sep 2005
    Location
    Tanzania
    Posts
    4,662
    Mentioned
    2 Post(s)
    Tagged
    0 Thread(s)
    If you visit http://rakaz.nl, you will find a method (using PHP) to automatically put all your JS files into a single one, so that you only make one HTTP request. This is one of the main bottlenecks (HTTP requests). The same can be done with CSS.

  14. #14
    SitePoint Addict
    Join Date
    Jun 2009
    Posts
    317
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Ok so I found it and it what http://rakaz.nl/projects/combine/combine.phps

    What do I do with that??

    Sorry, am not up with this sort of stuff, as you might have guessed :P

  15. #15
    I meant that to happen silver trophybronze trophy Raffles's Avatar
    Join Date
    Sep 2005
    Location
    Tanzania
    Posts
    4,662
    Mentioned
    2 Post(s)
    Tagged
    0 Thread(s)
    You don't even need to look at that PHP source. Just follow the instructions, which basically involve three things:

    • Make an .htaccess file and put it in your base directory, with the mod_rewrite code from the instructions in it
    • Build your JS/CSS URI as explained in the instructions
    • Put the PHP file in the root and then run it.

  16. #16
    SitePoint Addict
    Join Date
    Jun 2009
    Posts
    317
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Right, ok thanks


    Will give it a go in the morning when my eyes don't sting

  17. #17
    I meant that to happen silver trophybronze trophy Raffles's Avatar
    Join Date
    Sep 2005
    Location
    Tanzania
    Posts
    4,662
    Mentioned
    2 Post(s)
    Tagged
    0 Thread(s)
    I'm all too familiar with that stinging sensation!

  18. #18
    SitePoint Evangelist Dave Morton's Avatar
    Join Date
    Sep 2003
    Location
    Carson City, NV
    Posts
    557
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Off Topic:

    Quote Originally Posted by Raffles
    I'm all too familiar with that stinging sensation!
    Aren't we all?
    Making a difference, one little psychotic episode at a time
    Geek Cave Creations
    Beta testers needed for pChat
    Dave's Gallery

  19. #19
    SitePoint Addict
    Join Date
    Jun 2009
    Posts
    317
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Update... av found a neat little plugin called WP Minify that takes my yslow grade from F to C..

    only problem is that it messes my css up http://i45.photobucket.com/albums/f5...07at233614.png

    But still, pretty good eh.. still working on getting it to A

  20. #20
    SitePoint Zealot
    Join Date
    Jun 2007
    Location
    Regina, SK, Canada
    Posts
    129
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Just thought I'd throw it out there that I wrote an article on minifying your js on the server side:
    http://boedesign.com/blog/2009/12/02...ipt-minifying/


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •