Mobile app version of vmapp.org
Login or Join
Harper822

: What is the maximum safe line length in css files? YUI Compressor and other minifiers tend to remove unnecessary whitespaces, causing long lines. Safari 5 seems to fail rendering some rules from

@Harper822

Posted in: #CrossBrowser #Css

YUI Compressor and other minifiers tend to remove unnecessary whitespaces, causing long lines. Safari 5 seems to fail rendering some rules from the css files when the file has more than 5000 characters per line (blog post about my experiences).

UglifyJS has a --max-line-len (default 32K characters) and the author says at the page


I’ve seen both FF and Chrome croak when all the code was on a single
line of around 670K


What is the maximum safe line length in css files? I would like to support most of the still active browsers, while still removing unnecessary whitespaces. Any references to specifications would be useful.

10.01% popularity Vote Up Vote Down


Login to follow query

More posts by @Harper822

1 Comments

Sorted by latest first Latest Oldest Best

 

@LarsenBagley505

To quote the Closure Compiler FAQ:


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.


jQuery (1.7.2) has a 32k single line limit. Since jQuery is a widely used library, I would use the 32k character limit as a guideline.

10% popularity Vote Up Vote Down


Back to top | Use Dark Theme