Use when swizzling Docusaurus theme components and editing theme elements — wrap or eject components from @docusaurus/theme-classic, override navbar/footer/sidebar/TOC/DocItem, place customised components under src/theme/, and choose safe (--wrap) vs full (--eject) swizzles. Triggers on tasks involving Docusaurus swizzling, theme component customization, navbar, footer, sidebar, or layout modifications.
77
97%
Does it follow best practices?
Impact
—
No eval scenarios have been run
Passed
No known issues
Swizzle components to customize Docusaurus theme behavior:
npm run swizzle @docusaurus/theme-classic ComponentName -- --wrapnpm run swizzle to browse available componentssrc/theme/ComponentName/List available components:
npm run swizzle @docusaurus/theme-classic -- --listCommonly swizzled: Footer, Navbar, DocItem, DocSidebar, TOC
Swizzling copies internal theme code into your project, so a wrong choice or a broken edit can fail the build. Work through it in order:
npm run swizzle @docusaurus/theme-classic -- --list--wrap unless you need to change the component's internals.npm run swizzle @docusaurus/theme-classic <Component> -- --wrapsrc/theme/<Component>/, then make your edits there.npm run build; if it errors, fix the swizzled component and re-run before moving on.For detailed documentation, see:
--wrap for minor changes to maintain upgrade compatibility