-
-
Notifications
You must be signed in to change notification settings - Fork 92
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
Default sort behaviour in any algorithm easily breaks retina versions #137
Comments
By default, we have lexicographical sorting to guarantee consistency in all situations. One common issue users have is something like > var normal = ['icon.png', 'icon-variation.png'];
undefined
> normal.sort();
[ 'icon-variation.png', 'icon.png' ]
> var retina = ['icon-2x.png', 'icon-variation-2x.png'];
undefined
> retina.sort();
[ 'icon-2x.png', 'icon-variation-2x.png' ] That being said, we also support disabling sorting via {
// src, dest
algorithmOpts: {
sort: false
}
} |
I forgot to write down the common solution to the naming issue. We recommend to use > var normal = ['icon-1x.png', 'icon-variation-1x.png'];
undefined
> normal.sort();
[ 'icon-1x.png', 'icon-variation-1x.png' ]
> var retina = ['icon-2x.png', 'icon-variation-2x.png'];
undefined
> retina.sort();
[ 'icon-2x.png', 'icon-variation-2x.png' ] |
Ok thx for the good explanation, as I said I disabled the sorting in the But if the I was also confused, why in the generated sprites.scss there are all those variables for retina which are never used. Using those could make the output much more reliable no matter if I use sorting or not. even if it creates a bit more css. |
Ah, sorry. I misread your initial issue and found it confusing why you sad You are totally right, we should be showing The excessive amount of variables in the non-CSS variation are due to the following reasoning:
|
Ok cool thx. I think it would suffice to adapt the documentation and give a small hint regarding the naming. |
I started updating the documentation on this and am realizing the contradiction. Due to What about adding a note in the README about not allowing for variations that are
> var normal = ['icon.png', 'icon-variation.png'];
undefined
> normal.sort();
[ 'icon-variation.png', 'icon.png' ]
> var retina = ['icon@2x.png', 'icon-variation@2x.png'];
undefined
> retina.sort();
[ 'icon-variation@2x.png', 'icon@2x.png' ] |
Yes I like the idea with the "@2x" suffix because this is also kind of a standard now. |
I think I had a ignorant resistance to the I am going to update the documentation/corresponding files now. I am also considering adding in a safety check (e.g. if a retina sprite has a |
Upon thinking about it further, the warning should really occur when an the a different amount of normal sprite names substring each other than retina sprite names substring each other.
But I think we are probably safe with the documentation for now. |
It turns out that if anyone was using the |
We have released a patched version of |
Awesome, great job! I will try it in the next days. |
For the sake of our records, a similar release has been published in |
Guys what about issue with @ in SASS any update on that? I am having errors because of it
|
@DarthMarcius I don't believe that's related to this issue. Please open a separate issue |
I spent quite some time now to find the reason why some of the retina versions of the sprites
were wrong.
Reason is that by default the layout algorithm sorts the sprites and in my case
the sorting was different in standard and retina. But the scss mixins currently expect the sprites
to be at the same offset.
Can this be changed to
sort:false
by default or change the mixing to actually use the retina positions?The text was updated successfully, but these errors were encountered: