Get a free trial // Grow your CSS skills // Land your dream job

Linked Stylesheets vs. include(); ?

  • # March 7, 2012 at 2:45 pm

    This is really more of a theoretical discussion, but is it better to use links to your css and js files, or to include them with php?
    Like this:

    Versus this:

    I know that in the first one, you can take advantage of caching, but the second one is much less http requests. Do any of you have an opinion on this?

    # March 7, 2012 at 2:51 pm

    If your css/script is less than 4kb then you could use the php include to reduce requests otherwise just call it the normal way

Viewing 2 posts - 1 through 2 (of 2 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