lib/hot_module.rb in hot_module-1.0.0.alpha13 vs lib/hot_module.rb in hot_module-1.0.0.alpha14
- old
+ new
@@ -143,10 +143,14 @@
module ContentMethod
# @return [String, Nokolexbor::Element]
def content = @_content
end
+ def replaced_content=(new_content)
+ @_replaced_content = new_content
+ end
+
# Override in component
#
# @return [Hash]
def attributes = {}
@@ -241,11 +245,11 @@
# We'll transfer everything over to a single style element
style_tag = tmpl_el.document.create_element("style")
style_tag.content = output_styles
end
- child_content = @_replaced_children || content
+ child_content = @_replaced_content || content
if self.class.shadow_root
# Guess what? We can reuse the same template tag! =)
tmpl_el["shadowrootmode"] = "open"
tmpl_el.children[0] << style_tag if style_tag
doc << child_content if child_content
@@ -358,11 +362,11 @@
yield previous_context
@_context_locals = previous_context
end
def _hmod_children_binding(attribute:, node:) # rubocop:disable Lint/UnusedMethodArgument
- @_replaced_children = node.children[0]
+ self.replaced_content = node.children[0]
node.remove
end
def _hmod_replace_binding(attribute:, node:)
if node.name == "template"
@@ -402,9 +406,10 @@
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"
require_relative "hot_module/component_renderer"
config.builder HoTModuLe::ComponentRenderer
end
end