Skip to content

Commit

Permalink
docs: eagerly load tag definition
Browse files Browse the repository at this point in the history
  • Loading branch information
bennypowers committed Jan 14, 2025
1 parent 0acb0cf commit ac508cf
Show file tree
Hide file tree
Showing 5 changed files with 19 additions and 6 deletions.
4 changes: 4 additions & 0 deletions docs/_includes/layouts/base.njk
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,10 @@
</style>
</noscript>

{# ensure ssr-support modules are loaded first #}
<script type="module">
import '/assets/javascript/ssr-support.js';
</script>
{% include "../partials/javascript/global.html" %}
</head>

Expand Down
4 changes: 3 additions & 1 deletion docs/_includes/layouts/pages/element.11ty.ts
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,9 @@ export default class ElementsPage extends Renderer<Context> {
</noscript>
<script type="module" data-helmet>
// although we load these ssr support modules elsewhere, we still
// need them here to ensure no double-rendering on webkit
import '/assets/javascript/ssr-support.js';
import '@uxdot/elements/uxdot-copy-button.js';
import '@uxdot/elements/uxdot-copy-permalink.js';
import '@uxdot/elements/uxdot-best-practice.js';
Expand Down Expand Up @@ -961,4 +964,3 @@ export default class ElementsPage extends Renderer<Context> {
}
}
};

3 changes: 3 additions & 0 deletions docs/_includes/layouts/pages/has-toc.njk
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,9 @@ layout: layouts/base.njk
data-helmet>

<script type="module" data-helmet>
// although we load these ssr support modules elsewhere, we still
// need them here to ensure no double-rendering on webkit
import '/assets/javascript/ssr-support.js';
import '@uxdot/elements/uxdot-toc.js';
</script>

Expand Down
9 changes: 4 additions & 5 deletions docs/_includes/partials/javascript/dsd-init.html
Original file line number Diff line number Diff line change
@@ -1,14 +1,13 @@
<script type="module">
// dsd polyfill needs to happen before hydration attempts
// lit-element-hydrate-support needs to be included before lit is loaded
import '/assets/javascript/dsd-polyfill.js';
import '@lit-labs/ssr-client/lit-element-hydrate-support.js';
import 'element-internals-polyfill';
// although we load these ssr support modules elsewhere, we still
// need them here to ensure no double-rendering on webkit
import '/assets/javascript/ssr-support.js';
// include these, which are often internal to elements,
// and are definitely required by context-picker and context-demo
// to avoid SSR defer-hydration bugs and SSR double-rendering bugs
import '@rhds/elements/rh-icon/rh-icon.js';
import '@rhds/elements/rh-surface/rh-surface.js';
import '@rhds/elements/rh-button/rh-button.js';
import '@rhds/elements/rh-tooltip/rh-tooltip.js';
import '@rhds/elements/rh-tag/rh-tag.js';
</script>
5 changes: 5 additions & 0 deletions docs/assets/javascript/ssr-support.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
// dsd polyfill needs to happen before hydration attempts
// lit-element-hydrate-support needs to be included before lit is loaded
import '/assets/javascript/dsd-polyfill.js';
import '@lit-labs/ssr-client/lit-element-hydrate-support.js';
import 'element-internals-polyfill';

0 comments on commit ac508cf

Please sign in to comment.