Fork Spritemapper on GitHub

Spritemapper

CSS Spritemap Generator

Spritemapper is...

Spritemapper is an application that merges multiple images into one and generates CSS positioning for the corresponding slices.

Batteries included. The package consists of a simple command-line tool that "does the job" and a Python library including its own PNG and CSS parser. The choice of writing/bundling this was to stay off 3rd-party requirements. Anybody who has ever had the pleasant job of installing PIL on various platforms should have a pretty good idea about what we're trying to avoid.

There are multiple alternatives to Spritemapper, but they all require a bit too much manual labour, whereas Spritemapper reads your current CSS and replaces background images and position with the generated result.

This technique drastically improves your website's loading speed, effectively reducing bandwidth by downloading fewer images.

Holy f---! how do I get it?

Open Terminal.app, urxvt, xterm or whatever and type easy_install spritemapper. The tarball is available on Spritemapper's PyPI page.

When done, spritemapper /path/to/static/css/**.css and it does its magic. Give the old --help a quick look, too.

Source


    
    

Output


    
example-sprite

Test