Sha256: effa13e187d695aa171f358c482d23ca74b0ff2e509b3a9dba771822c4661c4d
Contents?: true
Size: 1.23 KB
Versions: 1
Compression:
Stored size: 1.23 KB
Contents
# frozen_string_literal: true module Heartml class BridgetownRenderer < Bridgetown::Builder def build render_heart_modules end def render_heart_modules inspect_html do |doc, resource| view_context = Bridgetown::ERBView.new(resource) rdr = Heartml::TemplateRenderer.new(body: doc.at_css("body"), context: view_context) rdr.call end end end end Bridgetown.initializer :heartml do |config| # TODO: maybe we can ditch this once we're off ActiveSupport in Bridgetown Bridgetown::Component.extend ActiveSupport::DescendantsTracker Heartml.module_eval do def render_in(view_context, rendering_mode: :string, &block) self.rendering_mode = rendering_mode super(view_context, &block) end end Heartml::ClassMethods.module_eval do def component_template_path = heart_module end # Eager load all components config.hook :site, :after_reset do |site| unless site.config.eager_load_paths.find { _1.end_with?(site.config.components_dir) } site.config.eager_load_paths << site.config.autoload_paths.find { _1.end_with?(site.config.components_dir) } end end config.html_inspector_parser "nokolexbor" config.builder Heartml::BridgetownRenderer end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
heartml-1.0.0.beta15 | lib/heartml/bridgetown_renderer.rb |