Sprite Factory 1.4.2
Wed, Feb 29, 2012I have released a minor update to the sprite-factory ruby gem.
This version adds 2 small features:
Suppressing comments
You can now specify --nocomments
to the sf
script (or :nocomments => true
in ruby)
in order to suppress the comments that sprite-factory adds to the generated stylesheet.
NOTE: if you already minify your css then you probably dont need this
Support for images in sub-folders
Previous versions assumed that all images lived in a single folder with unique filenames, and the original file name was used as the CSS class to show the correct background sprite image, as shown here:
<img src='s.gif' class='high'> <!-- e.g. filename was high.png -->
<img src='s.gif' class='medium'> <!-- e.g. filename was medium.png -->
<img src='s.gif' class='low'> <!-- e.g. filename was low.png -->
This is still true, and is the normal use case, but with v1.4.2 you can now (optionally) include images in sub-folders, for which the relative path name will be used for the CSS class to show that image in HTML:
<img src='s.gif' class='other_high'> <!-- e.g. filename was other/high.png -->
<img src='s.gif' class='other_medium'> <!-- e.g. filename was other/medium.png -->
<img src='s.gif' class='other_low'> <!-- e.g. filename was other/low.png -->
This also resolves github issue #11 - ‘sprite factory assumes unique basenames are used’
Installation
As usual, installation is just a gem away:
$ gem install sprite-factory
And detailed instructions can be found in the README.
Let me know if you have any problems/feedback.
Enjoy!