Created
July 13, 2017 14:31
-
-
Save ball-hayden/3c8150413f0ce5a2896987b55c949fcb to your computer and use it in GitHub Desktop.
Timed Sprockets Load
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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