nzakas / cssembed

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

Option to output data URIs to separate stylesheet #8

Closed robflaherty closed 14 years ago

robflaherty commented 14 years ago

An option to place all of the converted images in a separate stylesheet would be very useful. http://duris.ru/ does this, by default I believe. Isolating the data URIs helps keep the original CSS clean and maintainable, allows images to be cached separately from styles, and makes it easier to set up workarounds for IE6/7.

nzakas commented 14 years ago

I'm not sure I understand what you're asking for. Can you explain in more detail how you envision this working and what the use case is?

robflaherty commented 14 years ago

Apologies. It may be beyond the scope of the project. Instead of embedding the data URIs in the main stylesheet, the background image declarations would be removed from the main stylesheet and recreated in a separate, dedicated data URI stylesheet.

Here's an example: http://getpepperminted.com/dev2/css/data-uris.css

Placing the data URIs in a separate file provides the option of serving alternate content to non-supportive browsers. It also allows the main CSS and the data URIs to be cached separately, which can be useful.

nzakas commented 14 years ago

Ah I see, thanks for the explanation. I do think this is beyond the scope of what CSSEmbed should do, as it's a pretty specific use case and this tool was really intended to be general-purpose. If someone wanted to do that, what I'd probably recommend is that they create the core style sheet and the images style sheet, and then use CSSEmbed to create the data URI-based style sheet by processing the already-existing images one.

What you're asking for would require CSSEmbed to fully parse the CSS to determine which styles belong where, and that's far beyond the scope of what I envisioned this tool to be.

That being said, I could see another tool being built on CSSEmbed to do just that.