cssembed icon indicating copy to clipboard operation
cssembed copied to clipboard

Support file size limits

Open nzakas opened this issue 16 years ago • 9 comments

It would be useful to include a file size limit, such that a data URI is not generated if a referenced file in the CSS is larger than a given size.

Probably also a good idea to add a warning in verbose mode when a data URI is longer than 32 KB because IE8 will ignore it.

nzakas avatar Nov 29 '09 06:11 nzakas

I'd support this, I had to disable embedded stylesheets for IE8 as a result of this issue

Seldaek avatar Jul 09 '10 08:07 Seldaek

The code is already written for this:

https://github.com/JustinTulloss/cssembed/commit/cfc49b43212a387dec41e05e50d0992c87d685ad

fearphage avatar Feb 23 '11 23:02 fearphage

The 2nd half of this request is addressed in v0.3.4

fearphage avatar Mar 06 '11 04:03 fearphage

If you don´t won´t to support IEs (f.e. on a mobile website) it would be nice if this feature is controllable via a parameter.

proposal: maxfilesize = 1 (default) maxfilesize = 0 (images are converted regardless the filesize)

danielkoch avatar Mar 11 '11 08:03 danielkoch

Coming back around to this. I'd like to support this request.

"if the encoded image ends up being over 10k, keep the image link."

I may be able to code it even. I'll see when I get some time.

fearphage avatar Mar 30 '11 20:03 fearphage

I think there are actually two possible useful options:

  1. Don't include the data URI if it's longer than x characters
  2. Don't include the data URI if the image is larger than x kb

nzakas avatar Apr 07 '11 17:04 nzakas

I tackled the URI length limit here: https://github.com/nzakas/cssembed/pull/20

fearphage avatar Apr 08 '11 16:04 fearphage

Cool, I'll take a look this weekend, thanks!

nzakas avatar Apr 08 '11 17:04 nzakas

Sorry, the weekend got away from me. I'll look at this as soon as I can!

nzakas avatar Apr 13 '11 03:04 nzakas