Skip to content

Instantly share code, notes, and snippets.

@steveafrost
Created June 18, 2017 18:03
Show Gist options
  • Save steveafrost/e3b65b13fe6ff9788fb1814866d609bb to your computer and use it in GitHub Desktop.
Save steveafrost/e3b65b13fe6ff9788fb1814866d609bb 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