提供大型CSS文件 [英] Serving a large CSS file

查看:107
本文介绍了提供大型CSS文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个大的minified CSS文件在大约50k,这是参考约30页。



将CSS分成一个基本文件,每个页面使用单独的CSS文件,可以显着减少加载时间,或者提供一个大文件几乎相同?谢谢。

解决方案

50k真的不是那么大 - 尤其是大多数人的互联网连接。



我会保留单个文件,因为:


  1. 您只需要一个HTTP请求



  2. b
    $ b

    类似的主题是使用 sprite sheet a> - 这是基本上相同的事情,一个大文件包含多个图像是有利的,今天许多较小的图像。


    I have a large minified CSS file at around 50k, this is referenced by about 30 pages.

    Would separating the CSS into one base file with separate CSS files for each page significantly reduce load time, or is serving one large file practically the same? Thank you.

    解决方案

    50k really isn't that large - especially with most people's internet connections.

    I'd keep the single file, because:

    1. You only need a single HTTP request to load the entire CSS
    2. CSS will be loaded for your entire website as soon as a single page is visited (which is nice for further browsing)

    A similar topic would be the use of sprite sheets - which is essentially the same thing in that one large file containing multiple images is favourable over many smaller images nowadays.

    这篇关于提供大型CSS文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆