Created
June 18, 2017 18:03
-
-
Save steveafrost/e3b65b13fe6ff9788fb1814866d609bb to your computer and use it in GitHub Desktop.
Middleman Inline SVG Helper
This file contains hidden or 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
helpers do | |
def inline_svg name | |
root = Middleman::Application.root | |
file_path = "#{root}/source/assets/images/svg/#{name}.svg" | |
if File.exists?(file_path) | |
File.read(file_path) | |
else | |
"<span class='icon-error'>Icon #{name} not found</span>" | |
end | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment