Permalink
Browse files

Merge pull request #13 from tchak/master

add support for rails >= 3.1 with assets pipeline
  • Loading branch information...
2 parents 77d1140 + aa61d74 commit 8495125b3ada7507bc9a71ea2c206bb07a85d755 @wycats committed Nov 12, 2011
Showing with 11 additions and 5 deletions.
  1. +11 −5 lib/rack-offline.rb
View
@@ -26,11 +26,17 @@ def initialize(options = {}, app = Rails.application, &block)
def cache_block(root)
Proc.new do
- files = Dir[
- "#{root}/**/*.html",
- "#{root}/stylesheets/**/*.css",
- "#{root}/javascripts/**/*.js",
- "#{root}/images/**/*.*"]
+ if Rails.version >= "3.1" && Rails.configuration.assets.enabled
+ files = Dir[
+ "#{root}/**/*.html",
+ "#{root}/assets/**/*.{js,css,jpg,png,gif}"]
+ else
+ files = Dir[
+ "#{root}/**/*.html",
+ "#{root}/stylesheets/**/*.css",
+ "#{root}/javascripts/**/*.js",
+ "#{root}/images/**/*.*"]
+ end
files.each do |file|
cache Pathname.new(file).relative_path_from(root)

0 comments on commit 8495125

Please sign in to comment.