lib/scavenger/compressor.rb in scavenger-0.1.2 vs lib/scavenger/compressor.rb in scavenger-0.2.0
- old
+ new
@@ -22,11 +22,12 @@
textPath tref tspan unknown use video view vkern)
end
def compress_dir
sheet = Dir.entries(@path)
- .select { |f| !File.directory? f }
+ .select { |f| should_compress? f }
+ .sort
.map { |f| compress_file(File.join(@path, f), f) }
.join("")
File.write(Scavenger::Config.sprite_path, "<svg>#{sheet}</svg>") unless Scavenger::Config.sprite_path.nil?
sheet
@@ -41,9 +42,14 @@
symbolize(doc, id)
doc.to_html
end
private
+
+ def should_compress?(filename)
+ !File.directory?(filename) &&
+ !File.basename(filename).start_with?('.')
+ end
def remove_comments(doc)
doc.xpath("//comment()").remove
end