View inline_svg_helpers.rb
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Inline svg from @tomeara https://gist.github.com/tomeara/6515860 | |
def inline_svg(path) | |
file = File.open("app/assets/images/#{path}", "rb") | |
raw file.read | |
end | |
# Use SVG internal link | |
def use_svg(clazz) | |
content_tag(:svg, content_tag(:use, "", { "xlink:href" => '#icon-' + clazz }), class: "icon icon-#{clazz}") | |
end |