module Sinatra::AssetPack
Constants
- Error
- PREFIX
- VERSION
Public Class Methods
clear_tilt_cache!(cache, app)
click to toggle source
Clear Tilt::Cache (used primarily for tests)
# File lib/sinatra/assetpack.rb, line 42 def self.clear_tilt_cache!(cache, app) cache.clear #app.clear_tilt_cache = false # Maybe it can be an option on app we can enable/disable? end
registered(app)
click to toggle source
# File lib/sinatra/assetpack.rb, line 6 def self.registered(app) app.helpers Helpers end
supported_formats()
click to toggle source
Returns a list of formats that can be served. Anything not in this list will be rejected.
# File lib/sinatra/assetpack.rb, line 12 def self.supported_formats @supported_formats ||= %w(css js png jpg gif svg otf eot ttf woff woff2 htc ico) end
tilt_formats()
click to toggle source
Returns a map of what MIME format each Tilt type returns.
# File lib/sinatra/assetpack.rb, line 17 def self.tilt_formats @formats ||= begin hash = Hash.new Tilt.mappings.each do |format, (engine, _)| # @todo Remove when fix is merged in tilt # https://github.com/rtomayko/tilt/pull/206 next if engine.nil? case engine.default_mime_type when 'text/css' then hash[format] = 'css' when 'application/javascript' then hash[format] = 'js' end end hash end end
tilt_formats_reverse()
click to toggle source
Returns the inverse of tilt_formats.
# File lib/sinatra/assetpack.rb, line 35 def self.tilt_formats_reverse re = Hash.new { |h, k| h[k] = Array.new } formats.each { |tilt, out| re[out] << tilt } out end
version()
click to toggle source
@deprecated Please use AssetPack::VERSION instead
# File lib/sinatra/assetpack/version.rb, line 6 def self.version VERSION end