Generate CSS sprites from cmd with css-sprite and node.js

Update: I’ve also found a different method, this time instead using a Python script called “Glue“.

I did this about 12 months, but recently had to setup a new development environment.
Here are some notes on setting up css-sprite.

  1. Install node.js
  2. Install css-sprite
    npm install css-sprite -g
  3. Have fun.

Usage:

  1. Create two folders src (add png files here) and images
  2. run the command from cmd:
    css-sprite images/ src/*.png -p scss -s sprite.scss 
  3. (Here I'm using scss, you can choose from LESS, SCSS or CSS, depending on the project).

Leave a Reply

Your email address will not be published. Required fields are marked *