lib/octicons.rb in octicons-2.1.0 vs lib/octicons.rb in octicons-3.0.0

- old
+ new

@@ -1,22 +1,12 @@ require "octicons/version" require "octicons/octicon" -require "nokogiri" require "json" module Octicons - OCTICONS_SVG_PATH = File.join(File.dirname(__FILE__), "svg/*.svg") + SPRITE_SHEET = File.read(File.join(File.dirname(__FILE__), "sprite.octicons.svg")).freeze + OCTICON_SYMBOLS = JSON.parse(File.read(File.join(File.dirname(__FILE__), "data.json"))).freeze - KEYWORDS = JSON.parse(File.read(File.join(File.dirname(__FILE__), "keywords.json"))) - CODEPOINTS = JSON.parse(File.read(File.join(File.dirname(__FILE__), "codepoints.json"))) - - OCTICON_SYMBOLS = {} - Dir[OCTICONS_SVG_PATH].each do |svg_path| - id = File.basename(svg_path, ".svg") - svg = Nokogiri::XML(File.read(svg_path)) - OCTICON_SYMBOLS[id] = { - :path => "<path d=\"#{svg.css("path").first["d"]}\"></path>", - :height => svg.css("svg").first["height"].to_i, - :width => svg.css("svg").first["width"].to_i - } + def self.sprite_sheet + SPRITE_SHEET.sub("><symbol", " style=\"width:0;height:0;visibility:hidden;\"><symbol") end end