Created
November 30, 2012 06:01
-
-
Save fliptheweb/4174011 to your computer and use it in GitHub Desktop.
Make Sassy classes from png images
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Incude imageList function | |
require File.join(File.dirname(__FILE__), 'image-list.rb') |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@each $image in imageList("img/folder/*") { | |
.image_#{$image} { | |
/* some styles here */ | |
} | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
module Sass::Script::Functions | |
def imageList(path) | |
return Sass::Script::List.new( | |
Dir.glob(path.value).map! { |x| Sass::Script::String.new(x.sub(".png","")) }, | |
:comma | |
) | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment