ThemeShaper Forums » Thematic


Performance - Optimizing script and css

(9 posts)
  • Started 3 years ago by soren
  • Latest reply from cross-eyed jack
  • This topic is not resolved
  1. Hello!

    I am looking into improving the loading time of the site. There is a lots of info telling to combine scripts and css to as few files as possible. I can understand that BUT how is it done and where do you put it. Fort the moment I have like 12-15 javascripts loading and the same amount of css, I have taken all the scripts and saved it into one file I am calling javascript.js. So where can I put it, how is it done?

    I can also read that is says "Avoid CSS @import" and in Thematic you have many of those...

    What is the best practise and how should it be done properly?


    Posted 3 years ago #
  2. Hi there,

    I would recommend using this:

    If you use dynamic body classes extensively watch out though, as it will cache it using the classes that are in place when the page is cached (unless that has been changed)

    Posted 3 years ago #
  3. joperron,

    I was thinking of not using plugins to start with, but I guess this is unavoidable!?

    <?php if (substr_count($_SERVER['HTTP_ACCEPT_ENCODING'], "gzip")) ob_start("ob_gzhandler"); else ob_start(); ?>

    I used this gzip in header.php but does not seem to help a lot...

    Posted 3 years ago #
  4. This plugin is very complete and will just make your life easier. If you have enough control on your (apache) webserver you can also install this:

    Posted 3 years ago #
  5. OK I will have look, but I do think you still can do more before using the plugins no? Is there no advantage to minify and optimize the scripts and css before using plugins?

    Posted 3 years ago #
  6. Hi:

    Working with the BT Extended Child Theme which is heavily customized. Installed W3Total Cache and went through the Minify settings for the CSS and JS files.

    When all was said and done, this plugin BROKE the theme-thank the Gods I had backed up the site before I made these changes.

    How can I improve the performance of the blog cache without causing a problem and wasting hours of time?

    Posted 3 years ago #
  7. i recently posted some .htaccess snippets for gzip, expire headers, clear etags.

    although its good practice to optimise where possible, i believe your web host is the major factor in web speed.

    people use y-slow to evaluate site speed. i can optimise a site to get A-grade each time and i dont feel theres much 'real-time' difference from when it was a C.

    the above link mentions enqueing scripts. if you've bundled all jquery plugins into one file, that needs to be enqeued. see the link. if you have a problem, let me know.

    as for avoiding css import. its not a great practice but i can see why thematic needs to do it.

    you can bunch everything into one and lose the imports, but when thematic updates, you dont. that said, at the very least, i'd transfer the following....
    the reset - not something that is often updated.
    your layout - not many lines of css to worthy import.

    hope any of this helps

    Posted 3 years ago #
  8. @soren, do you mean minimize the scripts by hand? if so, this can be done and you dont need plugin, but its pretty time consuming and if a new version of a jquery script is released, you'll have to do it all over again.

    @cross-eyed jack
    regarding total cache. it shouldn't break you theme.
    auto-minifying scripts & styles can sometimes break functionality and display.

    have you tried wp-super-cache, i hear thats favoured by many.
    tweaking a cache plugin properly is not an easy task

    Posted 3 years ago #
  9. hey-thanks for the quick response!

    That's exactly what happened. When I entered the file names into the option fields to minify the JS and CSS files-BAM! the layout shattered. And even though I restored the files from the backup the slider will not work now.Every one of the plugins that I am using is needed - so now I wondering if doing a fresh WP install is the solution or if i should just change the template.

    I'm miserable I put in a ton of hours on tweaking the layout and now it's gone.

    The life of a webdesigner.

    Posted 3 years ago #

RSS feed for this topic

Topic Closed

This topic has been closed to new replies.