Skip to content
Browse files

Only static asset should read length from disk

  • Loading branch information...
1 parent 4327eed commit 921f81cc9e536c7a46aad1d59e4d19768cc703f1 @josh josh committed Nov 2, 2011
Showing with 6 additions and 1 deletion.
  1. +0 −1 lib/sprockets/asset.rb
  2. +6 −0 lib/sprockets/static_asset.rb
View
1 lib/sprockets/asset.rb
@@ -37,7 +37,6 @@ def initialize(environment, logical_path, pathname)
@pathname = Pathname.new(pathname)
@content_type = environment.content_type_of(pathname)
@mtime = environment.stat(pathname).mtime
- @length = environment.stat(pathname).size
@digest = environment.file_digest(pathname).hexdigest
end
View
6 lib/sprockets/static_asset.rb
@@ -7,6 +7,12 @@ module Sprockets
# any processing or concatenation. These are typical images and
# other binary files.
class StaticAsset < Asset
+ def initialize(environment, logical_path, pathname)
+ super
+
+ @length = environment.stat(pathname).size
+ end
+
# Returns file contents as its `source`.
def source
# File is read everytime to avoid memory bloat of large binary files

0 comments on commit 921f81c

Please sign in to comment.
Something went wrong with that request. Please try again.