Sha256: 1d9c3f06193d37208d2a9ef19fc7165392dde374d2ea1106e9ac6b5cbe884f05
Contents?: true
Size: 1.3 KB
Versions: 1
Compression:
Stored size: 1.3 KB
Contents
# encoding: utf-8 # ensure these come first to avoid tilt warnings require 'compass' require 'sass' require 'coffee_script' # stdlib require 'base64' require 'escape_utils' require 'sinatra/base' require 'sprockets' # classy assets components require 'classy_assets/configuration' require 'classy_assets/sass/script/functions' require 'classy_assets/sprockets/sass_importer' require 'classy_assets/version' # Utility methods 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_data_uri_for(asset) asset = Configuration.sprockets[asset] base64 = Base64.encode64(asset.to_s).gsub(/\s+/, "") "data:#{asset.content_type};base64,#{EscapeUtils.escape_url(base64)}" 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.5.0 | lib/classy_assets.rb |