Sha256: a5f22a79cd276f5200b5b60b21f30d49b17d1725982f8b13188b3c57bec4abb5
Contents?: true
Size: 1.22 KB
Versions: 4
Compression:
Stored size: 1.22 KB
Contents
module PageflowScrolled # @api private module ReactServerSideRenderingHelper include Pageflow::RenderJsonHelper include PageflowScrolled::EntryJsonSeedHelper def render_scrolled_entry(entry) seed_json = render_json do |json| scrolled_entry_json_seed(json, entry) end ReactServerSideRenderingHelper.renderer.render('Root', "{seed: #{seed_json}}", {}) end def self.renderer if Rails.env.development? ReactServerSideRenderingHelper.new_renderer else @renderer ||= ReactServerSideRenderingHelper.new_renderer end end # Normally react-rails either tries to auto detect which asset # container (i.e. Webpack, Sprockets) to use or relies on an app # wide configuration. Specify it explicitly to decouple Pageflow # Scrolled from host application configuration. class ReactRenderer < ::React::ServerRendering::BundleRenderer def asset_container_class ::React::ServerRendering::WebpackerManifestContainer end end def self.new_renderer ReactRenderer .new(files: ['pageflow-scrolled-server.js'], # Define required external globals. code: 'function videojs() {};') end end end
Version data entries
4 entries across 4 versions & 1 rubygems