Sha256: 106d8d65a039af680592f78e791acc68df210a9aeb0a923b3ec4197a3c3ce8c3
Contents?: true
Size: 1.11 KB
Versions: 8
Compression:
Stored size: 1.11 KB
Contents
module Sprite module Styles # renders standard css style rules class CssGenerator def initialize(builder) @builder = builder end def write(path, sprite_files) # write styles to disk File.open(File.join(Sprite.root, path), 'w') do |f| write_standard_css(f, sprite_files) end end def write_standard_css(f, sprite_files) # set up class_name to append to each rule sprites_class = @builder.config['sprites_class'] ? ".#{@builder.config['sprites_class']}" : "" sprite_files.each do |sprite_file, sprites| background_url = @builder.background_url(sprite_file) sprites.each do |sprite| f.puts "#{sprites_class}.#{sprite[:group]}#{@builder.config['class_separator']}#{sprite[:name]} {" f.puts " background: #{background_url} no-repeat #{sprite[:x]}px #{sprite[:y]}px;" f.puts " width: #{sprite[:width]}px;" f.puts " height: #{sprite[:height]}px;" f.puts "}" end end end def extension "css" end end end end
Version data entries
8 entries across 8 versions & 1 rubygems