nzakas / cssembed

A tool for embedding data URIs in CSS files.
http://www.nczonline.net/
389 stars 30 forks source link

Support file size limits #6

Open nzakas opened 14 years ago

nzakas commented 14 years ago

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.

Seldaek commented 14 years ago

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

fearphage commented 13 years ago

The code is already written for this:

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

fearphage commented 13 years ago

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

danielkoch commented 13 years ago

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)

fearphage commented 13 years ago

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.

nzakas commented 13 years ago

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
fearphage commented 13 years ago

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

nzakas commented 13 years ago

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

nzakas commented 13 years ago

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