class Sprockets::Environment
Public Class Methods
new(root = ".") { |self| ... }
click to toggle source
`Environment` should initialized with your application's root directory. This should be the same as your Rails or Rack root.
env = Environment.new(Rails.root)
# File lib/sprockets/environment.rb, line 12 def initialize(root = ".") initialize_configuration(Sprockets) self.root = root self.cache = Cache::MemoryStore.new yield self if block_given? end
Public Instance Methods
cached()
click to toggle source
Returns a cached version of the environment.
All its file system calls are cached which makes `cached` much faster. This behavior is ideal in production since the file system only changes between deploys.
# File lib/sprockets/environment.rb, line 24 def cached CachedEnvironment.new(self) end
Also aliased as: index
find_all_linked_assets(*args, &block)
click to toggle source
# File lib/sprockets/environment.rb, line 33 def find_all_linked_assets(*args, &block) cached.find_all_linked_assets(*args, &block) end
find_asset(*args)
click to toggle source
# File lib/sprockets/environment.rb, line 29 def find_asset(*args) cached.find_asset(*args) end
load(*args)
click to toggle source
# File lib/sprockets/environment.rb, line 37 def load(*args) cached.load(*args) end