CSS文件的最大行长度 [英] Max line length for CSS files

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

问题描述

浏览器是否限制CSS文件中一行的长度?

Do browsers limit the length of a line in a CSS file?

有问题某些CSS样式在浏览器后无法识别我使用 sass --style压缩缩小代码。

I'm having a problem where certain CSS styles are not being recognized by the browser after I minify the code using sass --style compressed.

当样式在单独的行上时,它工作正常。如果我在缩小的CSS中的战略地点输入换行符,仍然仍然工作正常。所以这告诉我,CSS的编写方式和缩减方式并没有什么问题 - 而是浏览器似乎不喜欢格式化代码。

It works fine when the styles are on individual lines. And it still works fine if I enter a line break in strategic places in the minified CSS. So this tells me there is not a problem with the way the CSS is written or the way that the minification is happening - rather it seems like the browser just doesn't like something about the format minified code.

推荐答案

防火墙和代理有时会损坏或忽略大长度的CSS文件。

Firewalls and proxies sometimes corrupt or ignore large CSS files with very long lines.

https://developers.google.com/closure/compiler/faq#linefeeds p>

https://developers.google.com/closure/compiler/faq#linefeeds


为什么在编译的脚本中有随机换行?

Closure
编译器每500个字符有意添加换行符。
防火墙和代理有时会损坏或忽略带有很长行的大型JavaScript
文件。每500个字符添加换行符
可防止出现此问题。删除换行符对
脚本的语义没有影响。对代码大小的影响很小,编译器
优化换行符位置,以便在gzip压缩文件时代码大小减少甚至

The Closure Compiler intentionally adds line breaks every 500 characters or so. Firewalls and proxies sometimes corrupt or ignore large JavaScript files with very long lines. Adding line breaks every 500 characters prevents this problem. Removing the line breaks has no effect on a script's semantics. The impact on code size is small, and the Compiler optimizes line break placement so that the code size penalty is even smaller when files are gzipped.

本文直接适用于javascript文件。我相信它也适用于CSS文件。

The article directly applies to javascript files. I believe it is applies to CSS files as well.

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

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