Non-hydrated component shortcodes cause unnecessary HTML code in build
hippotastic opened this issue · comments
Describe the bug
When building pages that include component shortcodes without any hydrate
prop, the resulting HTML code contains unnecessary <slinkity-mount-point>
wrappers around the purely static components, as well as data-reactroot=""
props on the component's root elements.
If components are used extensively on a page, this behavior generates a lot of additional markup that does not serve any purpose for the end user and makes the HTML code appear less clean.
To Reproduce
Steps to reproduce the behavior:
- Create a new Slinkity project using
npm init slinkity
. - In the contained
index.md
, change the line{% component "Slinky.jsx", hydrate="eager" %}
to{% component "Slinky.jsx" %}
. - Run
npm run build
. - Open the generated
_site/index.html
and look for the Slinky HTML output.
Expected HTML output
<section class="slinky__container"><!-- Slinky SVG etc. --></section>
Actual HTML output
<slinkity-mount-point data-s-id="0"><section class="slinky__container" data-reactroot=""><!-- Slinky SVG etc. --></section></slinkity-mount-point>
+1
This will be removed for the 1.0 canary! Stay tuned 😁
Resolved in 1.0 canary
Great work, Ben! Many thanks for fixing this! Who doesn't love some clean markup?