Compass / compass

Compass is no longer actively maintained. Compass is a Stylesheet Authoring Environment that makes your website design simpler to implement and easier to maintain.
http://compass-style.org
Other
6.72k stars 1.18k forks source link

Any interest in better Sprite bin packing? #1422

Open kiafaldorius opened 11 years ago

kiafaldorius commented 11 years ago

I'm thinking I might want to spend an afternoon next week looking for and/or implementing a better packing algorithm for the sprites.

Is there any interest in it? Do you think it would be worth while to have a much slower, but much less-whitespacey spriter?

Might still spend a couple hours on it regardless of your answer...just wanted to hear your take on it, seems the spriting stuff hasn't been touched in 2 years...

scottdavis commented 11 years ago

have you used smart layout? http://compass-style.org/help/tutorials/spriting/sprite-layouts/#smart

kiafaldorius commented 11 years ago

I saw it last night when I skimmed through the code. But...I don't think it's very smart.

Here's a quick example, each colored square is a file:

mysprite-s792cf60370

Should be able to do better than that. Maybe not, I'm not sure. But I'm willing to give it a shot. In the interest of not re-inventing the wheel, I'd probably go searching up other css spriters first, someone's got to have figured something out by now...

scottdavis commented 11 years ago

so we have this idea of efficiency which will make the packer scan more and do what you want I think. this could be pulled out into a config and or refactored. I'm not against making this better but, just realize there is a trade off on size / speed.

https://github.com/chriseppstein/compass/blob/stable/lib/compass/sass_extensions/sprites/row_fitter.rb#L36-L38