Reputation: 4684
I'm looking for an image url helper for sinatra that allows me to do something similar to staticmatic's, where I can shortcut to a relative path like so...
=img "me.jpg"
Can anybody point me in the direction to where this might be online, or where I could learn how to write one, or provide an example of one they have already written
Many thanks
Upvotes: 0
Views: 3579
Reputation: 25944
Depending on what you want, you could use sinatra-static-asset or a helper like this:
helpers do
def img(name)
"<img src='images/#{name}' alt='#{name}' />"
end
end
Upvotes: 2