The Lodge is members-only design/dev videos and Office Hours.

Next Office Hours Session: "Implementing an SVG Icon System" Nov 30 - 6:00 PM Eastern

How to reduce number of http requests?

  • # April 18, 2013 at 8:34 pm


    I have used about 24 js plugins inside of my pages and when I use a speed optimization system it gives me a high http request error.

    How can I decrease this number?

    Is it good to put all of js codes inside of only one file?

    notice I’m using jquery , jquery ui , jqury cookie and …

    # April 19, 2013 at 12:02 am

    Yes. You need a build process. After you have completed your project you take all of your assets (JavaScript, CSS and Images), and you concatenate, minify and compress.

    What you will end up with is only one JavaScript and CSS file so browser doesn’t have to make multiple requests to the server. The order in which the files are concatenated matters.

    You can also conditionally load assets, so if you’re using WordPress:

    if (is_page(‘gallery’)){
    // code to load the asset

    this way you request the asset only when it is needed.

    You could have apache do this work for you with .htaccess file. See section [File concatenation]( line #509 from HTML5Boilerplate .htaccess file.

    # April 19, 2013 at 10:53 am

    Thank you @AlenAbdula !
    I’m now working on html version of my template.
    How should I do this work for html?

Viewing 3 posts - 1 through 3 (of 3 total)

You must be logged in to reply to this topic.

There's a whole bunch of content on CSS-Tricks.

Search for Stuff   •   Browse the Archives

Get the Newsletter ... or get the RSS feed