Module: Sinatra::AssetPack

Includes:
ClassMethods
Defined in:
lib/sinatra/assetpack.rb,
lib/sinatra/assetpack/css.rb,
lib/sinatra/assetpack/image.rb,
lib/sinatra/assetpack/engine.rb,
lib/sinatra/assetpack/helpers.rb,
lib/sinatra/assetpack/options.rb,
lib/sinatra/assetpack/package.rb,
lib/sinatra/assetpack/version.rb,
lib/sinatra/assetpack/compressor.rb,
lib/sinatra/assetpack/engines/yui.rb,
lib/sinatra/assetpack/configurator.rb,
lib/sinatra/assetpack/engines/less.rb,
lib/sinatra/assetpack/engines/sass.rb,
lib/sinatra/assetpack/html_helpers.rb,
lib/sinatra/assetpack/class_methods.rb,
lib/sinatra/assetpack/engines/jsmin.rb,
lib/sinatra/assetpack/buster_helpers.rb,
lib/sinatra/assetpack/engines/simple.rb,
lib/sinatra/assetpack/engines/sqwish.rb,
lib/sinatra/assetpack/engines/uglify.rb,
lib/sinatra/assetpack/engines/closure.rb

Defined Under Namespace

Modules: BusterHelpers, ClassMethods, Compressor, Configurator, Css, Helpers, HtmlHelpers Classes: ClosureEngine, Engine, Image, JsminEngine, LessEngine, Options, Package, SassEngine, SimpleEngine, SqwishEngine, UglifyEngine, YuiEngine

Constant Summary collapse

PREFIX =
File.dirname(__FILE__)
Error =
Class.new(StandardError)

Class Method Summary collapse

Methods included from ClassMethods

#add_compressed_routes!, #add_individual_routes!, #assets, #assets_initialize!

Class Method Details

.registered(app) ⇒ Object



6
7
8
# File 'lib/sinatra/assetpack.rb', line 6

def self.registered(app)
  app.helpers Helpers
end

.supported_formatsObject

Returns a list of formats that can be served. Anything not in this list will be rejected.



12
13
14
# File 'lib/sinatra/assetpack.rb', line 12

def self.supported_formats
  @supported_formats ||= %w(css js png jpg gif svg otf eot ttf woff htc)
end

.tilt_formatsObject

Returns a map of what MIME format each Tilt type returns.



17
18
19
20
21
22
23
24
25
26
27
28
29
# File 'lib/sinatra/assetpack.rb', line 17

def self.tilt_formats
  @formats ||= begin
    hash = Hash.new
    Tilt.mappings.each do |format, (engine, _)|
      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_reverseObject

Returns the inverse of tilt_formats.



32
33
34
35
36
# File 'lib/sinatra/assetpack.rb', line 32

def self.tilt_formats_reverse
  re = Hash.new { |h, k| h[k] = Array.new }
  formats.each { |tilt, out| re[out] << tilt }
  out
end

.versionObject



3
4
5
# File 'lib/sinatra/assetpack/version.rb', line 3

def self.version
  "0.1.6"
end