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/hasharray.rb,
lib/sinatra/assetpack/compressor.rb,
lib/sinatra/assetpack/engines/yui.rb,
lib/sinatra/assetpack/configurator.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, HashArray, Image, JsminEngine, Options, Package, SassEngine, SimpleEngine, SqwishEngine, UglifyEngine, YuiEngine
Constant Summary collapse
- PREFIX =
File.dirname(__FILE__)
- Error =
Class.new(StandardError)
Class Method Summary collapse
- .registered(app) ⇒ Object
-
.supported_formats ⇒ Object
Returns a list of formats that can be served.
-
.tilt_formats ⇒ Object
Returns a map of what MIME format each Tilt type returns.
-
.tilt_formats_reverse ⇒ Object
Returns the inverse of tilt_formats.
- .version ⇒ Object
Methods included from ClassMethods
#add_compressed_routes!, #add_individual_routes!, #assets, #assets_initialize!
Class Method Details
.registered(app) ⇒ Object
5 6 7 |
# File 'lib/sinatra/assetpack.rb', line 5 def self.registered(app) app.helpers Helpers end |
.supported_formats ⇒ Object
Returns a list of formats that can be served. Anything not in this list will be rejected.
11 12 13 |
# File 'lib/sinatra/assetpack.rb', line 11 def self.supported_formats @supported_formats ||= %w(css js png jpg gif svg otf eot ttf woff htc) end |
.tilt_formats ⇒ Object
Returns a map of what MIME format each Tilt type returns.
16 17 18 19 20 21 22 23 24 25 26 27 28 |
# File 'lib/sinatra/assetpack.rb', line 16 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_reverse ⇒ Object
Returns the inverse of tilt_formats.
31 32 33 34 35 |
# File 'lib/sinatra/assetpack.rb', line 31 def self.tilt_formats_reverse re = Hash.new { |h, k| h[k] = Array.new } formats.each { |tilt, out| re[out] << tilt } out end |
.version ⇒ Object
3 4 5 |
# File 'lib/sinatra/assetpack/version.rb', line 3 def self.version "0.0.1" end |