benhoIIand / grunt-sprite-generator

Grunt task that generates a sprite from images referenced in a stylesheet and then updates the references with the new sprite image and positions
Other
18 stars 9 forks source link

add 'background' rule, along with 'background-image' #7

Closed akhoury closed 10 years ago

akhoury commented 10 years ago

looks like the imageRegex only supports background-image, but the process skips over css rules such as:

    background: url("assets/img.png");
vishwanatharondekar commented 10 years ago

Having it skip the background only sounds good idea to me. If you have any background which you dont want to be processed by the sprite creator, you can use this.

akhoury commented 10 years ago
vishwanatharondekar commented 10 years ago

I agree to point that directives are good idea. To answer your question when I will want it to skip sprites.

  1. When you are using background repeat it gets complex http://stackoverflow.com/questions/8083869/is-it-possible-to-use-repeating-background-images-in-sprites, and I will want to skip those.
  2. When you are using background-size. Complex solutions available. http://stackoverflow.com/questions/2430206/how-can-i-scale-an-image-in-a-css-sprite
  3. When you are using gif backgrounds.

In a large project also I will not blindly create a sprite with all the images and will want to control what goes in and out, so I will definitely go over all the rules. And I dont think you will have more than 20 images in your project for which you will want to create sprite. You will want to left out the images from library like jquery ui, etc from this.