Skip to content

Instantly share code, notes, and snippets.

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