Created stylesheet_url and javascript_url liquid filters
This commit is contained in:
parent
91aa975973
commit
41472c88bd
@ -3,9 +3,9 @@ module Locomotive
|
||||
module Filters
|
||||
module Html
|
||||
|
||||
# Write the link to a stylesheet resource
|
||||
# input: url of the css file
|
||||
def stylesheet_tag(input, media = 'screen')
|
||||
# Write the url to a stylesheet resource
|
||||
# input: name of the css file
|
||||
def stylesheet_url(input)
|
||||
return '' if input.nil?
|
||||
|
||||
unless input =~ /^(\/|http:)/
|
||||
@ -14,12 +14,22 @@ module Locomotive
|
||||
|
||||
input = "#{input}.css" unless input.ends_with?('.css')
|
||||
|
||||
input
|
||||
end
|
||||
|
||||
# Write the link to a stylesheet resource
|
||||
# input: url of the css file
|
||||
def stylesheet_tag(input, media = 'screen')
|
||||
return '' if input.nil?
|
||||
|
||||
input = stylesheet_url(input)
|
||||
|
||||
%{<link href="#{input}" media="#{media}" rel="stylesheet" type="text/css" />}
|
||||
end
|
||||
|
||||
# Write the link to javascript resource
|
||||
# input: url of the javascript file
|
||||
def javascript_tag(input)
|
||||
# Write the url to javascript resource
|
||||
# input: name of the javascript file
|
||||
def javascript_url(input)
|
||||
return '' if input.nil?
|
||||
|
||||
unless input =~ /^(\/|http:)/
|
||||
@ -28,7 +38,17 @@ module Locomotive
|
||||
|
||||
input = "#{input}.js" unless input.ends_with?('.js')
|
||||
|
||||
%{<script src="#{input}" type="text/javascript"></script>}
|
||||
input
|
||||
end
|
||||
|
||||
# Write the link to javascript resource
|
||||
# input: url of the javascript file
|
||||
def javascript_tag(input)
|
||||
return '' if input.nil?
|
||||
|
||||
input = javascript_url(input)
|
||||
|
||||
%{<script src="#{input}" type="text/javascript"></script>}
|
||||
end
|
||||
|
||||
def theme_image_url(input)
|
||||
|
Loading…
Reference in New Issue
Block a user