Skip to content

Clean up some Astro and Docs stuff#42355

Merged
mdo merged 1 commit intov6-devfrom
v6-astro-cleanup
Apr 30, 2026
Merged

Clean up some Astro and Docs stuff#42355
mdo merged 1 commit intov6-devfrom
v6-astro-cleanup

Conversation

@mdo
Copy link
Copy Markdown
Member

@mdo mdo commented Apr 23, 2026

  • Enabled prettier-plugin-astro in site/.prettierrc.json so docs-prettier-check actually checks .astro files, then ran --write across the site to catch drift it had been silently missing.
  • Wrapped the adjacent <Stylesheet /> / <ScssProd.default /> in Head.astro in a JSX fragment so the newly-enabled Astro Prettier plugin parses it cleanly.
  • Deleted the dead site/src/assets/snippets.js (nothing imported it) and removed its entry from eslint.config.js.
  • Added a @bootstrap path alias (tsconfig + Vite resolve.alias) pointing at dist/js/bootstrap.bundle.js, and replaced every ../../../../dist/js/bootstrap.bundle.js import with it — 7 files: site/src/assets/partials/snippets.js, site/src/assets/partials/toc.js, site/src/libs/clipboard.ts, site/src/components/shortcodes/Code.astro, ButtonPlayground.astro, MenuPlacementPlayground.astro, NavbarPlacementPlayground.astro. Keeps every docs script importing from a single module instance (no duplicated component registries).
  • Harmonized the "internal docs helper, don't reuse this" banner comment across application.js, search.js, partials/sidebar.js, partials/sticky.js, partials/toc.js, partials/snippets.js, and stackblitz.js.
  • Dropped the unused @assets/* tsconfig path alias.
  • Removed the unused layout prop from Stylesheet.astro (and the two callers in Head.astro / ExamplesLayout.astro).
  • Added an explanatory comment next to the is:inline color-modes.js references in Head.astro and ExamplesLayout.astro documenting why it stays outside the Vite pipeline (needs to render-block pre-paint to avoid a flash of the wrong theme).
  • Looked at collapsing DocsScripts.astro into Scripts.astro but Astro bundles <script> per component file, so inlining it under a {layout === 'docs' && ...} guard either breaks bundling or always-loads the StackBlitz SDK — kept it split and added a comment explaining why.
  • Exported SidebarGroup / SidebarItem / SidebarSubItem types inferred from the Zod sidebar schema in libs/data.ts, and swapped the any casts in DocsSidebar.astro + DocsLayout.astro for the real types. Added a null guard on item.title in DocsSidebar.astro since the schema field is optional.
  • Consolidated stripMarkdown / processMarkdownToHtml in libs/utils.ts onto a single remark + remark-html pipeline, dropping the direct mdast-util-from-markdown / mdast-util-to-string imports in the process.
  • Removed the @oddbird/css-anchor-positioning polyfill <script> from Head.astro and uninstalled the devDep — nothing in v6-dev actually declares anchor-name (that work lives on the unmerged feature/popover-api-anchor-positioning branch), so the polyfill was a no-op on every page. Easy to add back when that branch lands.

@mdo mdo requested a review from julien-deramond April 23, 2026 18:17
@mdo mdo requested a review from a team as a code owner April 23, 2026 18:17
@mdo mdo added the docs label Apr 23, 2026
@mdo mdo added this to v6.0.0 Apr 23, 2026
@mdo mdo added the v6 label Apr 23, 2026
@github-project-automation github-project-automation Bot moved this to Inbox in v6.0.0 Apr 23, 2026
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I understand why this file is being removed in this PR given the current state of v6. However, we were already facing an issue prior to this change: StackBlitz no longer works when a component requires JavaScript (e.g. Tooltips).

I'm fine merging this PR as is, but it raises a broader question: do we still want to support the StackBlitz feature? I’ve noticed that on most component pages, the button isn’t even present anymore.

In other words, should I open a follow-up PR to restore StackBlitz support, or remove it entirely from the docs?

Copy link
Copy Markdown
Member

@julien-deramond julien-deramond left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Due to the noise generated by the Prettier modifications, I cannot guarantee that I have caught every detail. Regarding the JavaScript loading changes, modifications in site/src/assets/partials/snippets.js and related files appear to function correctly in the following three environments:

  • Locally, using npm run start (tested with tooltips and popovers).
  • Using the sequence npm run release ; npm run docs ; cd _site ; http-server (tested with tooltips, popovers, and toasts).
  • On the Netlify deployment (tested with tooltips, popovers, and toasts).

Before merging, there's this question over here @mdo so I can know how to handle Stackblitz: #42355 (comment)

@mdo mdo merged commit 030a3ff into v6-dev Apr 30, 2026
13 checks passed
@mdo mdo deleted the v6-astro-cleanup branch April 30, 2026 17:12
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

Status: Inbox

Development

Successfully merging this pull request may close these issues.

2 participants