module Graspi::AssetsIncludeHelper

Public Instance Methods

graspi_file_path(path) click to toggle source
# File lib/graspi/helpers/assets_include_helper.rb, line 38
def graspi_file_path(path)
  mapping = Graspi.manifest(Rails.env)

  mapping[path]
end
graspi_image_tag(path, options = {}) click to toggle source
# File lib/graspi/helpers/assets_include_helper.rb, line 32
def graspi_image_tag(path, options = {})
  tag_options = options.merge({ src: graspi_file_path(path) })

  tag(:img, tag_options)
end
graspi_image_url(path) click to toggle source
# File lib/graspi/helpers/assets_include_helper.rb, line 28
def graspi_image_url(path)
  graspi_file_path(path)
end
graspi_javascript_include_tag(*sources) click to toggle source
# File lib/graspi/helpers/assets_include_helper.rb, line 17
def graspi_javascript_include_tag(*sources)
  options = sources.extract_options!.stringify_keys

  sources.uniq.map { |source|
    tag_options = {
      "src" => graspi_file_path("#{source}.js")
    }.merge!(options)
    content_tag(:script, "", tag_options)
  }.join("\n").html_safe
end