Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Merge pull request #13 from tchak/master

add support for rails >= 3.1 with assets pipeline
  • Loading branch information...
commit 8495125b3ada7507bc9a71ea2c206bb07a85d755 2 parents 77d1140 + aa61d74
@wycats authored
Showing with 11 additions and 5 deletions.
  1. +11 −5 lib/rack-offline.rb
View
16 lib/rack-offline.rb
@@ -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)
Please sign in to comment.
Something went wrong with that request. Please try again.