Skip to content

Instantly share code, notes, and snippets.

@hasssan
Forked from morewry/config.rb
Created March 12, 2013 09:10
Show Gist options
  • Save hasssan/5141373 to your computer and use it in GitHub Desktop.
Save hasssan/5141373 to your computer and use it in GitHub Desktop.
# http://stackoverflow.com/questions/10314907/getting-a-list-of-files-in-sass-compass
require File.join(File.dirname(__FILE__), 'listfiles.rb')
// http://compass-style.org/help/tutorials/spriting/magic-selectors/
// http://stackoverflow.com/questions/10314907/getting-a-list-of-files-in-sass-compass
@import "icons/*.png";
@each $file in listFiles("images/icons/*.png") {
.#{$file} {
// %#{$file} { for placeholder
@include icons-sprite($file);
}
}
# http://stackoverflow.com/questions/10314907/getting-a-list-of-files-in-sass-compass
module Sass::Script::Functions
def listFiles(path)
return Sass::Script::List.new(
Dir.glob(path.value).map! { |x| Sass::Script::String.new(File.basename(x, '.*')) },
:comma
)
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment