Sha256: 8981b133133967999f217cf181cf2c964628fa9eb536dc6e3f950971c2d0b857

Contents?: true

Size: 1016 Bytes

Versions: 1

Compression:

Stored size: 1016 Bytes

Contents

module Sass::Script::Functions
  def stringify_string(stringish)
    if stringish.instance_of?(::String)
      stringish
    else
      stringish.value
    end
  end

  def asset_route_helper(root, basename)
    basename_string = stringify_string(basename)

    item = system.source["#{root}/#{basename_string}"]
    r = system.router.route(item)

    quoted_string(r)
  end

  def font_route(basename)
    asset_route_helper(fonts_root, basename)
  end

  def font_url(basename)
    basename_string = stringify_string(basename)

    if basename_string.include?("?")
      basename_parts = basename_string.split("?")

      base = "#{basename_parts[0]}"
      qs   = "?#{basename_parts[1]}"

      path_to_font = quoted_string(font_route(base).value + qs)

      unquoted_string("url(#{path_to_font})")
    else
      unquoted_string("url(#{font_route(basename)})")
    end
  end

  def image_url(basename)
    img_route = asset_route_helper(images_root, basename)
    unquoted_string("url(#{img_route})")
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
munge-0.6.0 lib/munge/go/sass/asset_urls.rb