Jump to content

@import is a good practice?

- - - - -

This topic has been archived. This means that you cannot reply to this topic.
2 replies to this topic

#1
Guest_johnny.dacu_*

Guest_johnny.dacu_*
  • Guests
I know that one technique is to include some css files on main one with @import.
Isn't this a bad practice? Because with @import browser still makes the request, and if the main is blank then you could endup with n+1 requests.

#2
WingedPanther

WingedPanther

    A spammer's worst nightmare

  • Moderators
  • 16,831 posts
It's a good practice because if ALL the files on your site use the same CSS files, then they will only be downloaded once for the entire site, and even for several visits to the site (caching).
Programming is a branch of mathematics.
My CodeCall Blog | My Personal Blog

#3
DarkLordofthePenguins

DarkLordofthePenguins

    Programming Expert

  • Members
  • PipPipPipPipPipPip
  • 409 posts
Importing from one of your own stylesheets is fine, but kind of useless as you can just include the other stylesheet in the same web page. Importing from somewhere else, like another website, is a bad idea as that stylesheet may change, thus changing your website along with it.