cricketbash — 2011-12-14T19:03:40-05:00 — #1
Well, I'm a noob and this is my first post and Hello to all!
I'm using a customized blogger template for my blog (visit it here: cricketbash.
Does it improve performance in terms of load time, browser caching?
Any ideas to tidy up the xml template code are welcome.. Thanks
ralphm — 2011-12-14T19:31:23-05:00 — #2
Hi cricketbash. Welcome to SitePoint.
Hmm, that sounds like overkill to me. I've not heard of CSS hosted externally before. It can be handy to have something like a jQuery library linked through Google, because users may well have that cached from visiting other sites, but no one will have your personal CSS/JS files cached, so it won't make any difference on that score. I would think that managing the CSS/JS files would be more awkward if hosted at a different location from your other site files. Anyway, I'd be interested if anyone else thinks differently; but personally, I wouldn't do it.
felgall — 2011-12-14T20:27:17-05:00 — #3
Anything remotely hosted suffers two problems.
- It takes longer to load because of the extra domain lookup (unless your visitor already has it cached because it is shared between lots of sites - eg grabbing jQuery from Google).
- It means that the site will break if either of two servers is down instead of only one.
system — 2011-12-15T03:10:36-05:00 — #4
Yeah I would have to say that externally hosting CSS is unnecessary. Just host it yourself. It's faster on load time, easier to edit and manage as well
cricketbash — 2011-12-15T13:58:35-05:00 — #5
WOW! That's lightning fast replies.. Thanks very much, both Ralph & Steve(felgall).
@Ralph: Well, I do agree that its a bit of an overkill for a blog and for a simple xml template. But people using external style sheets isn't uncommon.. In fact, it is used all the time for large sites, except for the fact that they combine CSS files into as few HTTP requests as possible to cut down on RTT(round trip times). Thanks for your time, however, I fully appreciate it..
@Steve Chapman: WOW! I cudn't run into a better online guru than you.. Felgall, I'm humbled, Touchwood! (am I a flatterer?). But I understand that you are a About.com guide and I hold you in awe!
Coming back to our thread, yep, I'm indeed aware of DNS look ups & RTT.
I only opened this thread to know better about the "Browser caching" principle and how it enables us to cut down on load times. I read somewhere on the net that ppl online could be so impatient that they leave your site if it doesn't load within 7 secs.
I really appreciate and look forward to your reply. Thanks Steve, Your fan base has now gone up by 1 more..
and yes, how did you like my cricket blog( I still have to do heck lotta work on it though)? Do you like cricket?
Until next time.. Cheers!
xhtmlcoder — 2011-12-15T14:59:49-05:00 — #6
You'd keep the CSS external away from the markup instead of inline. If inline it would just add the individual page weights and slow rendering (also maybe a bigger maintenance issue) and wouldn't really be cached if were within the markup. Since each page would have to fully load first if it contained the CSS instead of a linking to a common CSS file.
The issue with the JS was, if it's an extremely famous online library used by tens of thousands of websites. Then the probability of a user already having download the script from a specific URI are higher like Ralph mentioned. Else it might be better writing or hosting your own.
cricketbash — 2011-12-15T19:33:29-05:00 — #7
If inline it would just add the individual page weights and slow rendering (also maybe a bigger maintenance issue) and wouldn't really be cached if were within the markup.
Thanks Xhtmlcoder for your reply..
But boy, isn't it getting hotter? Well, Two contrasting views there.. Individual page rendering vs Browser caching.. which is faster?
Xhtmlcoder makes a valid point, as CSS is not cached and every subsequent page has to be rendered individually..
That's the reason why I landed here, but I'm clueless and confused on which school of thought to follow..I couldn't figure out the relative advantages of both methods and am desperate to seek a clarification..
Waitin' for felgall..
ralphm — 2011-12-15T19:38:14-05:00 — #8
There are two issues here: 1) whether or not your CSS should be hosted externally, and 2) whether to put your CSS styles inline or not. Point 1) is perhaps debatable, but regarding point 2), using inline styles is absolute madness, so just don't do it. It destroys the whole point of CSS—which is the ability to change site-wide styles from a single location. (To update inline styles you'd have to open every page in the site separately and modify the those styles over and over again, which is untenable.)
felgall — 2011-12-15T20:08:59-05:00 — #9
What you should be doing with the CSS is placing it in external files that are hosted on the same server as the rest of the site. That way you get all the benefits - caching between pages, only one copy to change etc - without the overheads of having to look up a different server and having the page layout break if that other server goes down.