Installation
Docusaurus的初始设计就是要易于安装并让你的网站可以迅速运行。 To install Docusaurus, we have created an easy script that will get all of the infrastructure setup for you:
Ensure you have the latest version of Node installed. We also recommend you install Yarn as well.
Node版本必须至少为 6.x, 尽管我们推荐 Node 8.x或更高版本。
进入自己Github仓库的最上级目录,您将在这里创建文档。
yarn global add docusaurus-init
ornpm install --global docusaurus-init
docusaurus-init
After docusaurus is installed, moving forward, you can check your current version of Docusaurus by going into the
website
directory and typingnpm list docusaurus
. You can update to the latest version of Docusaurus by typingnpm update
.
Along with previously existing files and directories, your root directory will now contain a structure similar to:
root-of-repo
├── docs-examples-from-docusaurus
│ └── doc1.md
│ └── doc2.md
│ └── doc3.md
│ └── exampledoc4.md
│ └── exampledoc5.md
└── website
│ └── blog-examples-from-docusaurus
│ └── 2016-03-11-blog-post.md
│ └── 2017-04-10-blog-post-two.md
│ └── core
│ └── Footer.js
│ └── node_modules
│ └── package.json
│ └── pages
│ └── sidebars.json
│ └── siteConfig.js
│ └── static
If you do not want to install the init script globally, you can install it locally and then run it via
npx docusaurus-init
or from thenode_modules
directory that is created via./node_modules/.bin/docusaurus-init
. You may want to remove the createdpackage.json
file andnode_modules
directory after you run the script.
验证安装
Running the Docusaurus initialization script, docusaurus-init
, produces a runnable, example website to base your site upon.
- 在根目录中, 重命名
docs-examples-from-docusaurus
为docs
。 cd website
- 重命名
blog-examples-from-docusaurus
为blog
。 - 通过
yarn start
或npm start
运行本地服务器。 - Load the example site at http://localhost:3000. You should see the example site loaded in your web browser.