Sha256: 6ba18cd968b51166fad4bfa8a579d1ddbcd1560a1bff6a2b46d126cf13f6cea6
Contents?: true
Size: 1.38 KB
Versions: 4
Compression:
Stored size: 1.38 KB
Contents
# frozen_string_literal: true module Bridgetown module ViewComponentARCHIVED # NOTE: Currently not in use...might need to revisit when dual Rails/Bridgetown # installs are present def self.setup_hooks Bridgetown::Hooks.register :site, :pre_render, reloadable: false do ::ViewComponent::CompileCache.cache.each do |component_class| component_class.undef_method(:call) end ::ViewComponent::CompileCache.cache.clear end Bridgetown::Hooks.register :site, :post_render, reloadable: false do |_post| ::ViewComponent::CompileCache.cache.each do |component_class| component_class.undef_method(:call) end ::ViewComponent::CompileCache.cache.clear end end def self.included(klass) klass.extend ClassMethods end module ClassMethods def content_format(type) @content_format = type end def format_for_content @content_format ||= :default end end def content if self.class.format_for_content == :markdown && view_context.respond_to?(:markdownify) view_context.markdownify(@content).html_safe else super end end def render_in(view_context, &block) if view_context.class.name&.start_with? "Bridgetown" singleton_class.include ViewComponentHelpers end super end end end
Version data entries
4 entries across 4 versions & 1 rubygems