N
N
Nikita2014-04-03 06:22:27
css
Nikita, 2014-04-03 06:22:27

How to customize CSS output template in Grunt Spritesmith?

I'm implementing this thing into the project https://github.com/Ensighten/grunt-spritesmith
The generator itself is quite simple and already makes a sprite perfectly, but the output CSS can be optimized by reducing it by about a quarter.
This is what the output looks like by default:

.icon-audio-mid {
  background-image: url(build/sprite.png);
  background-position: -32px -128px;
  width: 32px;
  height: 32px;
}

I want to implement the following output:
.icon {
  background-image: url(build/sprite.png);
}
.icon-audio-mid {
  background-position: -32px -128px;
  width: 32px;
  height: 32px;
}
.icon-video-mid {
  background-position: -32px -128px;
  width: 32px;
  height: 32px;
}

And assign two classes to the tag with the icon - icon and the class of the specific icon. But I can't beat the plugin's templating engine, either it's output as default or there are no class names.
If there is any documentation more detailed than on github, I will be grateful.

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question