Sunday, 15 September 2013

Sinatra: Helper method won't "translate" a variable

Sinatra: Helper method won't "translate" a variable

I'm writing this helper:
helpers do
def css(*stylesheets)
stylesheets.map do |stylesheet|
'<link href="/#{stylesheet}.css" media="screen, projection"
rel="stylesheet" />'
end.join
end
end
Problem is, when I add it to the views (using the slim templating engine)
with:
==css :styles
and look at the HTML, I see:
<link href="/#{stylesheet}.css" media="screen, projection"
rel="stylesheet" />
Why doesn't this helper method translate #{stylesheet} into the
appropriate file? I tried restarting the server and everything, but
nothing worked so far.

No comments:

Post a Comment