Permalink
Browse files

Add Jammit for automatic asset compression

  • Loading branch information...
1 parent 286b23e commit 821bc5955246bcfcaf039751a62683a10eb56635 @stravid stravid committed Feb 8, 2012
Showing with 64 additions and 10 deletions.
  1. +3 −1 .gitignore
  2. +1 −0 Gemfile
  3. +10 −0 Gemfile.lock
  4. +3 −9 app/views/layouts/application.html.erb
  5. +2 −0 config/application.rb
  6. +43 −0 config/assets.yml
  7. +2 −0 config/environments/production.rb
View
4 .gitignore
@@ -5,4 +5,6 @@ tmp/**/*
config/database.yml
-material/
+material/
+
+.DS_Store
View
1 Gemfile
@@ -3,6 +3,7 @@ source 'http://rubygems.org'
gem 'rails', '3.0.0'
gem "will_paginate", "~> 3.0.pre2"
+gem 'jammit'
group :test do
gem 'shoulda'
View
10 Gemfile.lock
@@ -1,6 +1,10 @@
GEM
remote: http://rubygems.org/
specs:
+ POpen4 (0.1.4)
+ Platform (>= 0.4.0)
+ open4
+ Platform (0.4.0)
abstract (1.0.0)
actionmailer (3.0.0)
actionpack (= 3.0.0)
@@ -36,6 +40,8 @@ GEM
faker (0.9.4)
i18n (~> 0.4)
i18n (0.4.1)
+ jammit (0.6.5)
+ yui-compressor (>= 0.9.3)
machinist (1.0.6)
mail (2.2.7)
activesupport (>= 2.3.6)
@@ -44,6 +50,7 @@ GEM
mime-types (1.16)
mysql2 (0.2.6)
mysql2 (0.2.6-x86-mingw32)
+ open4 (1.3.0)
polyglot (0.3.1)
rack (1.2.1)
rack-mount (0.6.13)
@@ -72,13 +79,16 @@ GEM
polyglot (>= 0.3.1)
tzinfo (0.3.23)
will_paginate (3.0.pre2)
+ yui-compressor (0.9.6)
+ POpen4 (>= 0.1.4)
PLATFORMS
ruby
x86-mingw32
DEPENDENCIES
faker
+ jammit
machinist
mysql2
rails (= 3.0.0)
View
12 app/views/layouts/application.html.erb
@@ -9,8 +9,8 @@
<title>MARBLE RUN</title>
- <%= stylesheet_link_tag "reset", "master" %>
- <%= javascript_include_tag :defaults %>
+ <%= include_stylesheets :marblerun %>
+ <%= include_javascripts :rails %>
<%= csrf_meta_tag %>
<script type="text/javascript">
@@ -353,19 +353,13 @@
</div>
- <script src="../javascripts/marblerun/main.js"></script>
-
<%= yield %>
</td>
</tr>
</table>
- <% ActionView::Helpers::AssetTagHelper.register_javascript_expansion :marblerun => ["prototype", "cookie", "box2d/box2d", "marblerun/utilities/rectangle", "marblerun/utilities/utilities", "marblerun/utilities/pattern", "marblerun/utilities/event", "marblerun/utilities/eventengine", "marblerun/utilities/displayobject", "marblerun/bricks/brick", "marblerun/bricks/kicker", "marblerun/bricks/ramp", "marblerun/bricks/curve", "marblerun/bricks/line", "marblerun/bricks/exit", "marblerun/bricks/spring", "marblerun/bricks/boost", "marblerun/bricks/ball", "marblerun/bricks/breaker", "marblerun/bricks/beamer", "marblerun/bricks/oneway", "marblerun/bricks/graviton", "marblerun/bricks/ballbox", "marblerun/grid", "marblerun/toolbox", "marblerun/field", "marblerun/renderer", "marblerun/editor", "marblerun/showroom", "marblerun/meter", "marblerun/sidebarcontroller", "marblerun/contentloader", "marblerun/trackstore"] %>
-
- <% #ActionView::Helpers::AssetTagHelper.register_javascript_expansion :marblerun => ["marblerun-compiled"] %>
-
- <%= javascript_include_tag :marblerun %>
+ <%= include_javascripts :marblerun %>
</body>
View
2 config/application.rb
@@ -38,5 +38,7 @@ class Application < Rails::Application
# Configure sensitive parameters which will be filtered from the log file.
config.filter_parameters += [:password]
+
+ config.gem "jammit"
end
end
View
43 config/assets.yml
@@ -0,0 +1,43 @@
+embed_assets: on
+
+javascripts:
+ marblerun:
+ - public/javascripts/cookie.js
+ - public/javascripts/box2d/box2d.js
+ - public/javascripts/marblerun/main.js
+ - public/javascripts/marblerun/utilities/*.js
+ - public/javascripts/marblerun/bricks/brick.js
+ - public/javascripts/marblerun/bricks/kicker.js
+ - public/javascripts/marblerun/bricks/ramp.js
+ - public/javascripts/marblerun/bricks/curve.js
+ - public/javascripts/marblerun/bricks/line.js
+ - public/javascripts/marblerun/bricks/exit.js
+ - public/javascripts/marblerun/bricks/spring.js
+ - public/javascripts/marblerun/bricks/boost.js
+ - public/javascripts/marblerun/bricks/ball.js
+ - public/javascripts/marblerun/bricks/breaker.js
+ - public/javascripts/marblerun/bricks/beamer.js
+ - public/javascripts/marblerun/bricks/oneway.js
+ - public/javascripts/marblerun/bricks/graviton.js
+ - public/javascripts/marblerun/bricks/ballbox.js
+ - public/javascripts/marblerun/grid.js
+ - public/javascripts/marblerun/toolbox.js
+ - public/javascripts/marblerun/field.js
+ - public/javascripts/marblerun/renderer.js
+ - public/javascripts/marblerun/editor.js
+ - public/javascripts/marblerun/showroom.js
+ - public/javascripts/marblerun/meter.js
+ - public/javascripts/marblerun/sidebarcontroller.js
+ - public/javascripts/marblerun/contentloader.js
+ - public/javascripts/marblerun/trackstore.js
+ rails:
+ - public/javascripts/prototype.js
+ - public/javascripts/effects.js
+ - public/javascripts/dragdrop.js
+ - public/javascripts/controls.js
+ - public/javascripts/rails.js
+
+stylesheets:
+ marblerun:
+ - public/stylesheets/reset.css
+ - public/stylesheets/master.css
View
2 config/environments/production.rb
@@ -46,4 +46,6 @@
# Send deprecation notices to registered listeners
config.active_support.deprecation = :notify
+
+ config.serve_static_assets = true
end

0 comments on commit 821bc59

Please sign in to comment.