drdk / grunt-dr-svg-sprites

Grunt plugin to create SVG sprites with PNG fallbacks at needed sizes
113 stars 19 forks source link

Order of images not respected #33

Closed tbow closed 9 years ago

tbow commented 9 years ago

When creating sprites using over ten images, the file name order is not respected when creating the sprites/CSS. I am naming my files 001_image.svg, 002_image.svg, etc. As long as source image number is 10 or less the order is respected. This was a test run, I know that class names can't begin with numbers :)

filelist css

tbow commented 9 years ago

After some more research it seems that the second image is always the one getting "swapped"

wellhairy commented 9 years ago

This is a problem for me as well, ideally the output of the sprite would be in alphabetical order.

phloe commented 9 years ago

This behavior is definitely not intentional. Sorting must've dropped out during refactoring a while back. Hmm.

It should be easy to fix though - give me a sec. :)

phloe commented 9 years ago

Ok - I've added a sort on the sprite items before building the actual sprite.

The change is in dr-svg-sprites (version 0.9.16) and not the grunt wrapper - so you'll probably need to run npm cache clean and install!

tbow commented 9 years ago

capturev :( Still not working correctly. I did npm cache clean then a npm update to get the latest.

phloe commented 9 years ago

ugh I didn't test with filenames consisting of not just numbers...

Try updating again (version 0.9.18).

tbow commented 9 years ago

Updated but sorry, no dice. :( I tried both numbered and alpha names for the svg files and they both are still out of order as long as there are more than 10 files in the source directory. capture1 capture2 capture3

phloe commented 9 years ago

This thing had me pulling my hair out... The sorting routine I had added was working - but the external module the builder uses to do the actual layout reshuffled items around!?

Luckily that module had an option to omit shuffling ;)

Updated to version 0.9.19.

tbow commented 9 years ago

Fixed. Works great now! Thanks for your work on this, great plugin. This saves my team a great amount of time!

phloe commented 9 years ago

@tbow NP! And thanks for the heads-up :)

wellhairy commented 9 years ago

I'll also throw my thanks into the ring, I haven't tried it yet but this will be super helpful ;)