Sha256: a1c6697a9ba0a3d55c0dc0cf5cd9d1d352360df3fa07d54694a951385b38671a
Contents?: true
Size: 1.2 KB
Versions: 12
Compression:
Stored size: 1.2 KB
Contents
# frozen_string_literal: true require 'phlex' module Proscenium class Phlex < ::Phlex::View extend ActiveSupport::Autoload autoload :Component autoload :ReactComponent module Helpers def side_load_javascripts(...) if (output = @_view_context.side_load_javascripts(...)) @_target << output end end %i[side_load_stylesheets proscenium_dev].each do |name| define_method name do if (output = @_view_context.send(name)) @_target << output end end end end module Sideload def template(...) Proscenium::SideLoad.append self.class.path if Rails.application.config.proscenium.side_load super end end class << self attr_accessor :path def inherited(child) path = caller_locations(1, 1)[0].path child.path = path.delete_prefix(::Rails.root.to_s).delete_suffix('.rb')[1..] child.prepend Sideload child.include Helpers super end end def css_module(name) cssm.class_names!(name).join ' ' end private def cssm @cssm ||= Proscenium::CssModule.new(self.class.path) end end end
Version data entries
12 entries across 12 versions & 1 rubygems