silk_icons 1.2.0 → 1.2.1

Sign up to get free protection for your applications and to get access to all the features.
@@ -1,4 +1,4 @@
1
1
  module SilkIcons
2
- VERSION = '1.2.0'
2
+ VERSION = '1.2.1'
3
3
  ARCHIVE_VERSION = '1.3'
4
4
  end
@@ -74,20 +74,22 @@ namespace :silk_icons do
74
74
  end
75
75
 
76
76
  file "#{stylesheet}" => [ :unpack, "#{stylesheets_dir}" ] do |t|
77
- content = ''
77
+ content = <<-PREAMBLE.gsub(/^ /, '')
78
+ @mixin silk-icon-sprite-at-index($n) {
79
+ background-image: image-url('silk_icons/sprite.png') !important;
80
+ background-repeat: no-repeat !important;
81
+ background-position: ($n % 40) * (-16px) floor($n / 40) * (-16px) !important;
82
+ width: 16px !important;
83
+ height: 16px !important;
84
+ overflow: hidden !important;
85
+ }
86
+ PREAMBLE
78
87
  Dir.chdir ENV['SILK_ICONS_TMP'] do
79
88
  pngs = FileList['icons/*.png'].pathmap('%n').sort
80
- pngs.each_slice(40).with_index do |row, y|
81
- row.each.with_index do |png, x|
82
- content += <<-STYLE.lstrip
83
- .silk_icon-#{png} {
84
- background: image-url('silk_icons/sprite.png') no-repeat -#{x*16}px -#{y*16}px;
85
- width: 16px;
86
- height: 16px;
87
- overflow: hidden;
88
- }
89
- STYLE
90
- end
89
+ pngs.each_with_index do |png, i|
90
+ content += <<-STYLE.lstrip
91
+ .silk_icon-#{png} { @include silk-icon-sprite-at-index(#{i}); }
92
+ STYLE
91
93
  end
92
94
  end
93
95