博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
web前段优化的伎俩
阅读量:6687 次
发布时间:2019-06-25

本文共 1178 字,大约阅读时间需要 3 分钟。

Convert CSS images to data URIs automatically with CSSEmbed

data-uri-results

I wanted to play around with Nicholas Zakas’ new tool for automatically converting CSS background images to data URIs so I tested it out with the CSS on this site.  accepts a CSS file and outputs a copy with all image references replaced with base 64-encoded data URIs.  (If you’re unfamiliar with the concept of data URIs, read by Zakas.)

As you can see, the file size of your stylesheet increases significantly as the stylesheet takes on the image data.  But once you add compression you end up with roughly the same total load size.

In this example the total amount of data remained the same but the number of HTTP requests was reduced from 14 to 1.  Yikes!

There are still a few things with the concept that need to be sorted out – namely, the best way to handle IE 6&7, both of which do not support data URIs.  I’m planning to experiment with a few of the possible options later this week.  If you’re curious about the idea, I recommend trying out CSSEmbed with some of your own CSS.  It’s easy to use and kinda fun.  It feels a bit like the future.

 

转自

转载于:https://www.cnblogs.com/brucejia/archive/2012/02/17/2356140.html

你可能感兴趣的文章
XML+JSON面试题都在这里
查看>>
教你如何攻克Kotlin中泛型型变的难点(实践篇)
查看>>
2018Android面试经历
查看>>
不受限对抗样本挑战赛介绍
查看>>
浅解前端必须掌握的算法(三):直接插入排序
查看>>
[译] TensorFlow 教程 #06 - CIFAR-10
查看>>
阅读SSH的ERP项目【第二篇】
查看>>
如何有效的避免OOM,温故Java中的引用
查看>>
NSHipster: NSRegularExpression 中文版
查看>>
Android 开发中不得不知道的 Tips 集合 (持续更新 ing)
查看>>
报警系统QuickAlarm之报警规则的设定与加载
查看>>
【CLI】使用 Curl 下载文件实时进度条显示
查看>>
Android 滤镜效果和颜色通道过滤
查看>>
Ruby开发者已可通过Fog管理Microsoft Azure服务
查看>>
Chrome和HTTPS:安全Web的征途
查看>>
软件专家的对话模式(第一部分)
查看>>
脚本填报表的条件查询
查看>>
从一个开发的角度看负载均衡和LVS
查看>>
Spring Boot(12)——使用MongoDB
查看>>
c++基础(上) 听课流水账
查看>>