Last active
October 26, 2017 13:40
-
-
Save vortizhe/940df5fe59ef646269b0c58bc399ffce to your computer and use it in GitHub Desktop.
Middleman inline svg helper
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
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