Sha256: 5a7888e703f0e7c88db10f5c6524d976a1b326fcd19399632566f571c66bd06a

Contents?: true

Size: 924 Bytes

Versions: 1

Compression:

Stored size: 924 Bytes

Contents

# encoding: utf-8

require 'compass'
require 'sass'
require 'coffee_script'
require 'sprockets'
require 'sinatra/base'
require 'classy_assets/configuration'
require 'classy_assets/sass_script_functions'
require 'classy_assets/version'

module ClassyAssets
  def self.asset_url_for(asset)
    asset = Configuration.sprockets[asset].send(determine_path_type)
    debug = (Configuration.debug_mode) ? '?body=1' : ''
    "#{Configuration.asset_host}/#{Configuration.asset_prefix}/#{asset}#{debug}"
  end

  def self.asset_tag_from(sources, ext)
    sources = [sources] unless sources.is_a? Array
    sources.map do |source|
      source = "#{source}.#{ext}" unless source =~ /\.#{ext}$/
      asset_url = (source =~ /\/|http/) ? source : ::ClassyAssets.asset_url_for(source)
      yield(asset_url)
    end.join('')
  end

  def self.determine_path_type
    (Configuration.asset_digest) ? :digest_path : :logical_path
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
classy_assets-0.4.5 lib/classy_assets.rb