Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Is there grunt tasks for generating images sprites according by css?

Let's say I have the following style.css file:

h1 {
  padding: 10px;
  background: url('/img/header.png');
}
p {
   background: url('/img/p.png');
}

I need to make image sprite for this css automatically. I need to get something like this:

h1 {
  padding: 10px;
  background: url('/img/sprite.png') -47px 0;
}
p {
   background: url('/img/sprite.png') -130px 0;
}

Is it possible to make automaticaly by using grunt task?

like image 441
Erik Avatar asked Apr 07 '13 10:04

Erik


2 Answers

It looks like you are looking for this grunt-sprite-generator. From the documentation:

Grunt task that generates a sprite from images referenced in a stylesheet and then updates the references with the new sprite image and positions

Another tool that looks to fit the bill is grunt-spritesmith

like image 164
Jim Avatar answered Nov 02 '22 07:11

Jim


How about using Grunt Imagine?

like image 33
iGanja Avatar answered Nov 02 '22 06:11

iGanja