Module: Sinatra::Exstatic::Helpers
- Includes:
- Private
- Defined in:
- lib/sinatra/exstatic_assets.rb
Overview
These are the helpers available to a Sinatra app using the extension.
Instance Method Summary collapse
- #favicon_tag(*args) ⇒ Object (also: #link_favicon_tag, #favicon)
-
#image_tag(*sources) ⇒ #to_s
(also: #img_tag)
Produce an HTML img tag.
-
#javascript_tag(*sources) ⇒ #to_s
(also: #javascript_include_tag, #js_tag, #script_tag)
Produce an HTML script tag.
-
#stylesheet_tag(*sources) ⇒ #to_s
(also: #css_tag, #stylesheet)
Produce an HTML link tag to a stylesheet.
Instance Method Details
#favicon_tag(*args) ⇒ Object Also known as: link_favicon_tag, favicon
283 284 285 286 287 288 289 290 291 292 293 294 |
# File 'lib/sinatra/exstatic_assets.rb', line 283 def favicon_tag(*args) source, = args source = "favicon.ico" if source.nil? or source.empty? # xhtml style like <link rel="shortcut icon" href="http://example.com/myicon.ico" /> [:rel] ||= settings.xhtml ? "shortcut icon" : "icon" = .delete(:url_options) || {} [:href] = sss_url_for(Asset.new(source), .merge(timestamp: false)) Tag.new "link", end |
#image_tag(*sources) ⇒ #to_s Also known as: img_tag
Produce an HTML img tag.
|
# File 'lib/sinatra/exstatic_assets.rb', line 228
|
#javascript_tag(*sources) ⇒ #to_s Also known as: javascript_include_tag, js_tag, script_tag
Produce an HTML script tag.
260 261 262 263 264 265 266 267 |
# File 'lib/sinatra/exstatic_assets.rb', line 260 %w{image_tag stylesheet_tag javascript_tag}.each do |method_name| define_method method_name do |*sources| list, = sources list.map {|source| send "sss_#{method_name}", source, }.join "\n" end end |
#stylesheet_tag(*sources) ⇒ #to_s Also known as: css_tag, stylesheet
Produce an HTML link tag to a stylesheet.
|
# File 'lib/sinatra/exstatic_assets.rb', line 239
|