Dan
Dan

Reputation: 3358

Getting image width and height from compass sprites

I'm having trouble getting the image width and height when generating a sprite from compass. I'm using Scout for my live watch and already configured my images folder. I have my images that I want to sprite in a folder called common.

Here's my code

@import "common/*.png";
.facebook { @include common-sprite(facebook); }

This works and generates the background position, but I want to get the width and height.

Any would be awesome!

Upvotes: 2

Views: 1338

Answers (2)

verlok
verlok

Reputation: 193

If you don't want ALL your sprites usages to be defined with the image size, you can also:

@import "common/*.png";
.facebook { @include common-sprite(facebook, true); }

That trueparameter will generate width and height for the image only in the .facebook class definition.

Upvotes: 0

Dan
Dan

Reputation: 3358

I found the solution. Adding $common-sprite-dimensions: true; (link to compass sprite options docs) will put the width and height into the output.

Upvotes: 4

Related Questions