Sha256: 3cfc67217b3cb7eddfd1fec6f87596f648538b3fe0d7269d849d9dfcc055b719
Contents?: true
Size: 885 Bytes
Versions: 2
Compression:
Stored size: 885 Bytes
Contents
module React module ServerRendering # Get asset content by reading the compiled file from disk using the generated maniftest.yml file # # This is good for Rails production when assets are compiled to public/assets # but sometimes, they're compiled to other directories (or other servers) class YamlManifestContainer def initialize @assets = YAML.load_file(::Rails.root.join("public", ::Rails.application.config.assets.prefix, "manifest.yml")) end def find_asset(logical_path) asset_path = @assets[logical_path] || raise("No compiled asset for #{logical_path}, was it precompiled?") asset_full_path = ::Rails.root.join("public", ::Rails.application.config.assets.prefix, asset_path) File.read(asset_full_path) end def self.compatible? ::Rails::VERSION::MAJOR == 3 end end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
react-rails-1.10.0 | lib/react/server_rendering/yaml_manifest_container.rb |
react-rails-1.9.0 | lib/react/server_rendering/yaml_manifest_container.rb |