lib/react/server_rendering/manifest_container.rb in react-rails-2.7.1 vs lib/react/server_rendering/manifest_container.rb in react-rails-3.0.0.rc.0
- old
+ new
@@ -1,5 +1,7 @@
+# frozen_string_literal: true
+
module React
module ServerRendering
# Get asset content by reading the compiled file from disk using a Sprockets::Manifest.
#
# This is good for Rails production when assets are compiled to public/assets
@@ -8,11 +10,13 @@
def initialize
@manifest = ::Rails.application.assets_manifest
end
def find_asset(logical_path)
- asset_path = @manifest.assets[logical_path] || raise("No compiled asset for #{logical_path}, was it precompiled?")
- asset_full_path = ::Rails.root.join('public', @manifest.dir, asset_path)
+ asset_path = @manifest.assets[logical_path] || raise(
+ "No compiled asset for #{logical_path}, was it precompiled?"
+ )
+ asset_full_path = ::Rails.root.join("public", @manifest.dir, asset_path)
File.read(asset_full_path)
end
# sprockets-rails < 2.2.2 does not have `application.assets_manifest`
def self.compatible?