Skip to content

Instantly share code, notes, and snippets.

@fliptheweb
Created November 30, 2012 06:01
Show Gist options
  • Save fliptheweb/4174011 to your computer and use it in GitHub Desktop.
Save fliptheweb/4174011 to your computer and use it in GitHub Desktop.
Make Sassy classes from png images
# Incude imageList function
require File.join(File.dirname(__FILE__), 'image-list.rb')
@each $image in imageList("img/folder/*") {
.image_#{$image} {
/* some styles here */
}
}
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