module Frails::Component::RendererConcerns
Private Instance Methods
inlined_stylesheets()
click to toggle source
# File lib/frails/component/renderer_concerns.rb, line 35 def inlined_stylesheets if @view.instance_variable_defined?(:@inlined_stylesheets) @view.instance_variable_get :@inlined_stylesheets else @view.instance_variable_set :@inlined_stylesheets, [] end end
presenter_class()
click to toggle source
# File lib/frails/component/renderer_concerns.rb, line 8 def presenter_class if @component.is_a?(Class) && @component < Frails::Component::Base klass = @component @component = @component.to_s.underscore return klass end klass_file = Frails.components_path.join("#{@component}_component.rb") klass_file.exist? && "#{@component.to_s.camelcase}Component".constantize end
render_inline_styles()
click to toggle source
# File lib/frails/component/renderer_concerns.rb, line 19 def render_inline_styles # TODO: We don't yet have support for compiling Webpack for tests. return if Rails.env.test? # Don't inline the styles if already inlined. return if inlined_stylesheets.include?(@component) Frails.manifest.read(stylesheet_entry_file, :stylesheet) do |path, src| @view.content_for :component_styles do @view.content_tag(:style, src, { data: { href: path } }, false) end inlined_stylesheets << @component end end