Skip to content

Instantly share code, notes, and snippets.

@ball-hayden
Created July 13, 2017 14:31
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ball-hayden/3c8150413f0ce5a2896987b55c949fcb to your computer and use it in GitHub Desktop.
Save ball-hayden/3c8150413f0ce5a2896987b55c949fcb to your computer and use it in GitHub Desktop.
Timed Sprockets Load
module TimedSprocketsLoad
def load(uri)
result = nil
time = Benchmark.realtime do
result = super
end
if time > 0.5
Rails.logger.info "[Sprockets Time] #{time}s \t Loaded #{uri}"
end
result
end
end
module Sprockets
class CachedEnvironment
prepend TimedSprocketsLoad
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment