Tools to make CSS sprites? [closed]

2019-01-07 01:51发布

Are there any good tools to make css sprites?

IDEALLY I'd want to give it a directory of images and an existing .css file that refers to those images and have it create a big image optimized with all the little images AND change my .css file to refer to those images.

At the least I'd want it to take a directory of images and generate a big sprite and the .css necessary to use each as a background.

Are there any good photoshop plugins or fully blown apps to do this?

21条回答
兄弟一词,经得起流年.
2楼-- · 2019-01-07 01:59

This will do 90% of the work for you: http://spritegen.website-performance.org/. You'll still need to edit the rules yourself, but the tool will give you the code fragments you need for the new CSS file.

查看更多
劳资没心,怎么记你
3楼-- · 2019-01-07 01:59

There is now Sprite Me by Steve Souders. Just tries it out and it seems to work pretty well.

Here is the link http://spriteme.org/ and here is the blog post announcing it.

http://www.stevesouders.com/blog/2009/09/14/spriteme/

查看更多
我想做一个坏孩纸
4楼-- · 2019-01-07 02:02

found this one pretty fast tho that 500K upload limit might be a pain. source code is available here

查看更多
对你真心纯属浪费
5楼-- · 2019-01-07 02:05

There is a new tool out there called ActiveSprites, part of the active_assets gem.

Github: http://bitly.com/eRTwU4

You use a ruby dsl to define your sprites and then do "rake sprites" and the sprites and corresponding stylesheets get generated.

It's rad!

Here's some sample code,

# config/sprites.rb
Rails.application.sprites do
  sprite 'sprites/sprite1.png' => 'sprites/sprite1.css' do
    _'sprite_images/sprite1/1.png' => 'a.one'
    _'sprite_images/sprite1/2.png' => 'span.two'
  end
end
查看更多
SAY GOODBYE
7楼-- · 2019-01-07 02:08

I suggest you to use Sprite Master Web. I generates sprite sheets automatically and exports CSS code for you. It always tries to generate smallest sprite sheets with advanced algorithms.

Here is a screenshot and youtube video

enter image description here

查看更多
登录 后发表回答