java – 合并CSS文件

前端之家收集整理的这篇文章主要介绍了java – 合并CSS文件前端之家小编觉得挺不错的,现在分享给大家,也给大家做个参考。

我必须将CSS文件合并到一个大的CSS文件中,以减少页面加载期间的连接.基本上,如果我只是将CSS文件附加到一个大文件中,这些样式是否会像以前一样工作,或者将多个CSS文件合并在一起时是否存在任何问题?我正在用Java开发我的软件,如果有一些库已经进行了CSS合并,我想听听.

最佳答案
如果您的CSS文件使用@import,则将它们合并到一个文件中可能会更改导入的URL.

当@import具有相对URL时,它将根据包含CSS的URL进行解析,因此您最终可能会无意中破坏@imports.

http://www.w3.org/TR/css3-values/

In order to create modular style sheets that are not dependent on the absolute location of a resource,authors should use relative URIs. Relative URIs (as defined in [URI]) are resolved to full URIs using a base URI. RFC 3986,section 3,defines the normative algorithm for this process. For CSS style sheets,the base URI is that of the style sheet,not that of the source document.

原文链接:https://www.f2er.com/css/427102.html

猜你在找的CSS相关文章