class Sprockets::Environment
Public Class Methods
Source
# File lib/sprockets/environment.rb, line 13 def initialize(root = ".") initialize_configuration(Sprockets) self.root = root self.cache = Cache::MemoryStore.new yield self if block_given? end
‘Environment` should be initialized with your application’s root directory. This should be the same as your Rails or Rack root.
env = Environment.new(Rails.root)
Public Instance Methods
Source
# File lib/sprockets/environment.rb, line 25 def cached CachedEnvironment.new(self) end
Returns a cached version of the environment.
All of 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.
Also aliased as: index
Source
# File lib/sprockets/environment.rb, line 38 def find_all_linked_assets(*args, &block) cached.find_all_linked_assets(*args, &block) end
Source
# File lib/sprockets/environment.rb, line 30 def find_asset(*args, **options) cached.find_asset(*args, **options) end
Source
# File lib/sprockets/environment.rb, line 34 def find_asset!(*args) cached.find_asset!(*args) end
Source
# File lib/sprockets/environment.rb, line 42 def load(*args) cached.load(*args) end