Sha256: d115013d5173820bf8bc7d2bb190e6d5fc48f2c0fff879a0083876b30828ba1a

Contents?: true

Size: 589 Bytes

Versions: 5

Compression:

Stored size: 589 Bytes

Contents

# frozen_string_literal: true

module React
  module ServerRendering
    # 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.
    class EnvironmentContainer
      def initialize
        @environment = ::Rails.application.assets
      end

      def find_asset(logical_path)
        @environment[logical_path].to_s
      end
    end
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
react-rails-3.2.0 lib/react/server_rendering/environment_container.rb
react-rails-3.1.1 lib/react/server_rendering/environment_container.rb
react-rails-3.1.0 lib/react/server_rendering/environment_container.rb
react-rails-3.0.0 lib/react/server_rendering/environment_container.rb
react-rails-3.0.0.rc.0 lib/react/server_rendering/environment_container.rb