Module: Sinatra::Twitter::Bootstrap::Assets
- Defined in:
- lib/sinatra/twitter-bootstrap.rb
Constant Summary collapse
- ASSETS =
{ :css => [ ['bootstrap.min.css', 'a5cee949f15193b2e2f9aa7275051dea69d0eea1'], ['bootstrap-responsive.min.css', '68e924c9fcbee3cb5d47ca6d284fb3eec82dd304'], ], :png => [ ['glyphicons-halflings.png', '84f613631b07d4fe22acbab50e551c0fe04bd78b'], ], :js => [ ['jquery.min.js', '8b6babff47b8a9793f37036fd1b1a3ad41d38423'], ['bootstrap.min.js', '3e6ab2b64de4239acb763383a591d76a44053293'], ['html5.js', 'c9d8ca77abcd9789b91b4c3263f257e1fc1ee103'] ], }
Class Method Summary collapse
Class Method Details
.generate_bootstrap_asset_routes(app) ⇒ Object
24 25 26 27 28 29 30 31 32 33 34 35 36 |
# File 'lib/sinatra/twitter-bootstrap.rb', line 24 def self.generate_bootstrap_asset_routes(app) ASSETS.each do |kind, files| files.each do |file| name, sha1 = file kind_route = (kind == :png) ? :img : kind app.get '/%s/%s' % [kind_route.to_s, name], :provides => kind do cache_control :public, :must_revalidate, :max_age => 3600 etag sha1 File.read(File.join(File.dirname(__FILE__), 'assets', name)) end end end end |
.registered(app) ⇒ Object
38 39 40 41 42 |
# File 'lib/sinatra/twitter-bootstrap.rb', line 38 def self.registered(app) generate_bootstrap_asset_routes(app) app.helpers AssetsHelper app.helpers HAMLHelper end |