mirror of
https://github.com/middleman/middleman.git
synced 2022-11-09 12:20:27 -05:00
better helper logic
This commit is contained in:
parent
b35f026aba
commit
087f48c98d
1 changed files with 8 additions and 8 deletions
|
@ -25,22 +25,22 @@ module Middleman
|
|||
path.include?("://") ? path : File.join(base_url, path)
|
||||
end
|
||||
|
||||
def image_tag(path, options={})
|
||||
options[:alt] ||= ""
|
||||
params = options.merge(:src => asset_url(path, self.images_dir))
|
||||
def image_tag(path, params={})
|
||||
params[:alt] ||= ""
|
||||
params = params.merge(:src => asset_url(path, options.images_dir))
|
||||
params = params.map { |k,v| %Q{#{k}="#{v}"}}.join(' ')
|
||||
"<img #{params} />"
|
||||
end
|
||||
|
||||
def javascript_include_tag(path, options={})
|
||||
params = options.merge(:src => asset_url(path, self.js_dir), :type => "text/javascript")
|
||||
def javascript_include_tag(path, params={})
|
||||
params = params.merge(:src => asset_url(path, options.js_dir), :type => "text/javascript")
|
||||
params = params.map { |k,v| %Q{#{k}="#{v}"}}.join(' ')
|
||||
"<script #{params}></script>"
|
||||
end
|
||||
|
||||
def stylesheet_link_tag(path, options={})
|
||||
options[:rel] ||= "stylesheet"
|
||||
params = options.merge(:href => asset_url(path, self.css_dir), :type => "text/css")
|
||||
def stylesheet_link_tag(path, params={})
|
||||
params[:rel] ||= "stylesheet"
|
||||
params = params.merge(:href => asset_url(path, options.css_dir), :type => "text/css")
|
||||
params = params.map { |k,v| %Q{#{k}="#{v}"}}.join(' ')
|
||||
"<link #{params} />"
|
||||
end
|
||||
|
|
Loading…
Reference in a new issue