Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

sprite-url function generates sprite image several times #40

Open
yoonsy opened this issue Oct 6, 2014 · 3 comments
Open

sprite-url function generates sprite image several times #40

yoonsy opened this issue Oct 6, 2014 · 3 comments

Comments

@yoonsy
Copy link

yoonsy commented Oct 6, 2014

I'm developing on Rails framework ver 3.2.13.

On development environment, sprite-url function generates sprite image several times. So, it takes long time to precompile scss file.

For example, application.scss file looks like below.

@import "retina-sprites";
$sprites: sprite-map('to_sprite/*.png', $spacing: 1px);
$sprites2x: sprite-map('to_sprite/*.png', $spacing: 2px);

#logo {
  @include retina-sprite(logo);
}
#icon1 {
  @include retina-sprite(icon1);
}
#icon2 {
  @include retina-sprite(icon2);
}

I used retina-sprite mixin 3 times.

It causes generating sprite image 3 times.

@AdamBrodzinski
Copy link
Owner

Hmmm, is this using the master branch or 2.0 branch? Just curious because i'm about to merge 2.0 into master in the next few days. To be honest i'm not sure what's going on causing it to load 3 times. I've been using icon fonts lately so I haven't been using this for new projects.

@yoonsy
Copy link
Author

yoonsy commented Oct 8, 2014

I'm using master branch's _retina-sprites.scss.

@DmitryGonchar
Copy link

@AdamBrodzinski sprite-url() call generates the sprite, every time you call it.
I have solved this issue by using global :( variable.

$sprite-url: sprite-url($icons);
@mixin _retina-sprite ...
  background-image: $sprite-url;

Same for 2x sprite.
Btw, why don't you use background: shortcut instead of applying each property individually?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants