问题原文
原帖链接 · CamSpy · CC BY-SA 3.0
So I have a relatively big CSS file. I thought about doing the following, splitting it to 3 parts:
- 1st part will have the main selectors that are needed to run on the main page that gets the biggest traffic.
- 2nd part will have CSS for the rest of the pages
- 3rd page will have all the screen size dependent set up intended for mobile devices to have responsive pages
I am running my static files off a CDN and I would put each of these parts to a separate subdomain to have them all downloaded faster than one file.
Do you think this is a good way of doing that?
EDIT: since I didn't make clear, I am using CDN service on subdomains to serve all static content, so there are 5 subdomains that I use and they all are on CDN. Each of them is used to serve a number of files: CSS, JS, JPG, PNG, etc. DNS lookups are being made anyways.
社区高分解答
原帖链接 · John Conde · CC BY-SA 3.0
No. This will not make your site faster and is unnecessary. Multiple HTTP calls slow down your website, not speed it up.
To make your CSS load as fast as possible:
- Minify it
- Compress it using gzip (mod_deflate)
- Serve it from a CDN
Once the browser has the file it will cache it and no more requests will need to be made which is as fast as it gets.
摘自公开归档,保留原文语言,版式经整理,外部媒体与邮箱地址已移除。
