andrewdavey / cassette

Manages .NET web application assets (scripts, css and templates)
http://getcassette.net
MIT License
536 stars 144 forks source link

Lossless Image Optimization #73

Open nazjunaid opened 12 years ago

nazjunaid commented 12 years ago

I know Microsoft are currently developing the Sprite and Image Optimization library which is in preview 4.

However some of the features of both frameworks are starting to overlap.

Sprites does look quite tricky but I'm guessing with a bit of work lossless image optimization could be something that's possible with cassette's pipeline?

andrewdavey commented 12 years ago

Spriting is probably impossible to solve in general, given how simply parsing a CSS file won't tell you everything about how an image is being used (combing inherited rules, image repeats, positions, etc).

The RequestReduce project is tackling some of these issues: https://github.com/mwrock/RequestReduce I'm talking with Matt (the creator of RR) about maybe using some of his magic in Cassette.

I'm torn between

  1. having an automagic EnableSpriting property which magically rewrites CSS and breaks some of the time or requires hinting inline via comments.
  2. the MS approach of generating a separate CSS file just for the sprited images. This seems more predictable to work with, but of course requires an upfront decision to sprite.

I'll be thinking more about this problem. It does seem like the kind of thing Cassette should be handling :)