Linux command
docusaurus 命令
文本
复制后可按需替换文件名、目录或参数。
常用示例
Create a new Docusaurus site
npx create-docusaurus@latest [my-website] classic
Start the development server
npx docusaurus start
Start on a specific port
npx docusaurus start --port [8080]
Build the site for production
npx docusaurus build
Serve the production build locally
npx docusaurus serve
Deploy to GitHub Pages
npx docusaurus deploy
Clear generated files and caches
npx docusaurus clear
Tag a new documentation version
npx docusaurus docs:version [1.0]
说明
Docusaurus is a static site generator optimized for documentation websites. It uses React for the UI, Markdown/MDX for content, and provides features like versioning, i18n, and search out of the box. Sites are configured via docusaurus.config.js, defining metadata, themes, plugins, and navigation. Content lives in docs/ for documentation and blog/ for blog posts. The development server provides hot reloading. Production builds generate static HTML, CSS, and JavaScript that can be hosted anywhere. Built-in deployment support targets GitHub Pages.
参数
- start --port _n_
- Start development server (default port 3000).
- build --out-dir _path_
- Build static site for production.
- serve --port _n_
- Serve built site locally.
- deploy
- Deploy to GitHub Pages.
- clear
- Clear generated files and caches.
- swizzle _theme_ _component_
- Eject or wrap a theme component for customization (interactive).
- docs:version _version_
- Tag the current docs as a new version snapshot.
- write-translations
- Extract translatable strings to JSON translation files.
- write-heading-ids
- Add explicit heading IDs to Markdown documents.
- --locale _locale_
- Specify locale for the command.
- --config _path_
- Use a custom configuration file.
- --out-dir _path_
- Custom output directory for build (default: build/).
FAQ
What is the docusaurus command used for?
Docusaurus is a static site generator optimized for documentation websites. It uses React for the UI, Markdown/MDX for content, and provides features like versioning, i18n, and search out of the box. Sites are configured via docusaurus.config.js, defining metadata, themes, plugins, and navigation. Content lives in docs/ for documentation and blog/ for blog posts. The development server provides hot reloading. Production builds generate static HTML, CSS, and JavaScript that can be hosted anywhere. Built-in deployment support targets GitHub Pages.
How do I run a basic docusaurus example?
Run `npx create-docusaurus@latest [my-website] classic` in a terminal, then adjust file names, paths, flags, or remote targets for your system.
What does start --port _n_ do in docusaurus?
Start development server (default port 3000).