Only output media attribute if needed, delete redundant type attribute in stylesheet_tag

This commit is contained in:
Kaelig
2021-04-12 14:10:01 -07:00
parent 8ece160330
commit b1cdd31858

View File

@@ -18,7 +18,11 @@ module ShopFilter
end
def stylesheet_tag(url, media = "all")
%(<link href="#{url}" rel="stylesheet" type="text/css" media="#{media}" />)
html = []
html << %(<link href="#{url}" rel="stylesheet")
html << %(media="#{media}") if media != "all"
html << "/>"
html.join(" ")
end
def link_to(link, url, title = "")