class React::ServerRendering::EnvironmentContainer
Return asset contents by getting them from a Sprockets::Environment instance.
This is good for Rails
development but bad for production because:
-
It compiles the asset lazily, not ahead-of-time
-
Rails
5 / Sprockets 3 doesn’t expose a Sprockets::Environment in production.
Public Class Methods
new()
click to toggle source
# File lib/react/server_rendering/environment_container.rb, line 9 def initialize @environment = ::Rails.application.assets end
Public Instance Methods
find_asset(logical_path)
click to toggle source
# File lib/react/server_rendering/environment_container.rb, line 13 def find_asset(logical_path) @environment[logical_path].to_s end