sinatra-simple-assets 0.0.1 → 0.0.2

Sign up to get free protection for your applications and to get access to all the features.
data/README.md CHANGED
@@ -1 +1,37 @@
1
1
  # Sinatra Simple Assets
2
+
3
+ # Gemfile
4
+ gem 'sinatra-simple-assets', :require => 'sinatra/simple_assets'
5
+
6
+ # Sinatra app
7
+ register Sinatra::SimpleAssets
8
+
9
+ assets do
10
+ css :application, [
11
+ '/stylesheets/bootstrap.css',
12
+ '/stylesheets/application.css'
13
+ ]
14
+ js :application, [
15
+ '/javascripts/bootstrap-modal.js',
16
+ '/javascripts/bootstrap-dropdown.js',
17
+ '/javascripts/bootstrap-scrollspy.js',
18
+ '/javascripts/bootstrap-buttons.js',
19
+ '/javascripts/bootstrap-tabs.js',
20
+ '/javascripts/bootstrap-twipsy.js',
21
+ '/javascripts/bootstrap-popover.js',
22
+ '/javascripts/bootstrap-alerts.js',
23
+ '/javascripts/application.js'
24
+ ]
25
+ end
26
+
27
+ # Views
28
+ <%= javascript :application %>
29
+ <%= stylesheet :application %>
30
+
31
+ # Rakefile
32
+ namespace :assets do
33
+ desc 'Precompile assets'
34
+ task :precompile do
35
+ App.assets.precompile
36
+ end
37
+ end
@@ -126,26 +126,26 @@ module Sinatra
126
126
  def self.registered(app)
127
127
  app.helpers SimpleAssets::Helpers
128
128
 
129
- app.get '/stylesheets/:bundle' do
130
- serve_content(params[:bundle], :css)
131
- end
132
-
133
- app.get '/javascripts/:bundle' do
134
- serve_content(params[:bundle], :js)
135
- end
136
-
137
- def serve_content(bundle, type)
138
- assets = settings.assets
139
- exists = assets.bundle_exists?(bundle)
140
-
141
- etag bundle if exists
142
- not_found unless exists
143
-
144
- cache_control :public, :must_revalidate, :max_age => 86400
145
-
146
- content_type type
147
- assets.content_for(bundle)
129
+ [
130
+ { :route => '/stylesheets', :type => :css },
131
+ { :route => '/javascripts', :type => :js }
132
+ ].each do |r|
133
+ app.get "#{r[:route]}/:bundle" do
134
+ bundle = params[:bundle]
135
+ assets = settings.assets
136
+ exists = assets.bundle_exists?(bundle)
137
+
138
+ etag bundle if exists
139
+ not_found unless exists
140
+
141
+ cache_control :public, :must_revalidate, :max_age => 86400
142
+
143
+ content_type r[:type]
144
+ assets.content_for(bundle)
145
+ end
148
146
  end
149
147
  end
150
148
  end
149
+
150
+ register SimpleAssets
151
151
  end
@@ -1,10 +1,10 @@
1
1
  # -*- encoding: utf-8 -*-
2
2
  Gem::Specification.new do |s|
3
3
  s.name = 'sinatra-simple-assets'
4
- s.version = '0.0.1'
4
+ s.version = '0.0.2'
5
5
  s.authors = ["Pete O'Grady"]
6
6
  s.email = ['pete@peteogrady.com']
7
- s.homepage = ""
7
+ s.homepage = 'https://github.com/peteog/sinatra-simple-assets'
8
8
  s.summary = %q{Asset minification and bundling for Sinatra}
9
9
  s.description = %q{Asset minification and bundling for Sinatra}
10
10
 
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: sinatra-simple-assets
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.1
4
+ version: 0.0.2
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -13,7 +13,7 @@ date: 2011-12-15 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: cssmin
16
- requirement: &70317838571960 !ruby/object:Gem::Requirement
16
+ requirement: &70231129464120 !ruby/object:Gem::Requirement
17
17
  none: false
18
18
  requirements:
19
19
  - - =
@@ -21,10 +21,10 @@ dependencies:
21
21
  version: 1.0.2
22
22
  type: :runtime
23
23
  prerelease: false
24
- version_requirements: *70317838571960
24
+ version_requirements: *70231129464120
25
25
  - !ruby/object:Gem::Dependency
26
26
  name: sinatra
27
- requirement: &70317838570620 !ruby/object:Gem::Requirement
27
+ requirement: &70231129462880 !ruby/object:Gem::Requirement
28
28
  none: false
29
29
  requirements:
30
30
  - - ~>
@@ -32,10 +32,10 @@ dependencies:
32
32
  version: 1.3.0
33
33
  type: :runtime
34
34
  prerelease: false
35
- version_requirements: *70317838570620
35
+ version_requirements: *70231129462880
36
36
  - !ruby/object:Gem::Dependency
37
37
  name: therubyracer-heroku
38
- requirement: &70317838646680 !ruby/object:Gem::Requirement
38
+ requirement: &70231129543860 !ruby/object:Gem::Requirement
39
39
  none: false
40
40
  requirements:
41
41
  - - =
@@ -43,10 +43,10 @@ dependencies:
43
43
  version: 0.8.1.pre3
44
44
  type: :runtime
45
45
  prerelease: false
46
- version_requirements: *70317838646680
46
+ version_requirements: *70231129543860
47
47
  - !ruby/object:Gem::Dependency
48
48
  name: uglifier
49
- requirement: &70317838644740 !ruby/object:Gem::Requirement
49
+ requirement: &70231129541640 !ruby/object:Gem::Requirement
50
50
  none: false
51
51
  requirements:
52
52
  - - =
@@ -54,7 +54,7 @@ dependencies:
54
54
  version: 1.1.0
55
55
  type: :runtime
56
56
  prerelease: false
57
- version_requirements: *70317838644740
57
+ version_requirements: *70231129541640
58
58
  description: Asset minification and bundling for Sinatra
59
59
  email:
60
60
  - pete@peteogrady.com
@@ -68,7 +68,7 @@ files:
68
68
  - Rakefile
69
69
  - lib/sinatra/simple_assets.rb
70
70
  - sinatra-simple-assets.gemspec
71
- homepage: ''
71
+ homepage: https://github.com/peteog/sinatra-simple-assets
72
72
  licenses: []
73
73
  post_install_message:
74
74
  rdoc_options: []