Module: Asset::Helpers
- Defined in:
- lib/assets/helpers.rb
Instance Method Summary collapse
-
#image_tag(path) ⇒ Object
Image tags.
-
#script_tag(*paths) ⇒ Object
Script tags.
-
#style_tag(*paths) ⇒ Object
Style tags.
Instance Method Details
#image_tag(path) ⇒ Object
Image tags
19 20 21 22 |
# File 'lib/assets/helpers.rb', line 19 def image_tag(path) b = ::Asset.images[path] rescue nil %{<img src="/assets/images/#{CGI.escapeHTML(path)}#{b ? "?#{b}" : ''}">} rescue path end |
#script_tag(*paths) ⇒ Object
Script tags
5 6 7 8 9 |
# File 'lib/assets/helpers.rb', line 5 def script_tag(*paths) tag('js', *paths) do |src| %{<script src="#{src}"></script>} end end |
#style_tag(*paths) ⇒ Object
Style tags
12 13 14 15 16 |
# File 'lib/assets/helpers.rb', line 12 def style_tag(*paths) tag('css', *paths) do |src| %{<link href="#{src}" media="all" rel="stylesheet" type="text/css">} end end |