module Compass::Core::SassExtensions::Functions::Urls::StylesheetUrl

Public Class Methods

included(base) click to toggle source
# File lib/compass/core/sass_extensions/functions/urls.rb, line 16
def self.included(base)
  if base.respond_to?(:declare)
    base.declare :stylesheet_url, [:path]
    base.declare :stylesheet_url, [:path, :only_path]
  end
end

Public Instance Methods

stylesheet_url(path, only_path = bool(false)) click to toggle source
# File lib/compass/core/sass_extensions/functions/urls.rb, line 22
def stylesheet_url(path, only_path = bool(false))
  # Compute the path to the stylesheet, either root relative or stylesheet relative
  # or nil if the http_images_path is not set in the configuration.
  http_stylesheets_path = if relative?
    compute_relative_path(Compass.configuration.css_path)
  elsif Compass.configuration.http_stylesheets_path
    Compass.configuration.http_stylesheets_path
  else
    Compass.configuration.http_root_relative(Compass.configuration.css_dir)
  end

  path = "#{http_stylesheets_path}/#{path.value}"
  if only_path.to_bool
    unquoted_string(clean_path(path))
  else
    clean_url(path)
  end
end