class Sprockets::Svg::Cleaner
Public Class Methods
call(input)
click to toggle source
# File lib/sprockets/svg/cleaner.rb, line 15 def self.call(input) process(input[:data]) end
process(svg)
click to toggle source
TODO: integrate svgo instead: github.com/svg/svgo See github.com/lautis/uglifier on how to integrate a npm package as a gem.
# File lib/sprockets/svg/cleaner.rb, line 8 def self.process(svg) document = Nokogiri::XML(svg).css('svg') document.css('[display=none]').remove document.xpath('//comment()').remove document.to_s.gsub("\n", '').gsub(/>\s+</, '><').strip end