Skip to content

Commit c33e6a5

Browse files
authored
Add existing site install instructions (#229)
1 parent 57c0c3b commit c33e6a5

File tree

1 file changed

+47
-16
lines changed

1 file changed

+47
-16
lines changed

README.md

Lines changed: 47 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -37,35 +37,35 @@ _([npx](https://medium.com/@maybekatz/introducing-npx-an-npm-package-runner-55f7
3737
Then open [http://localhost:3000/](http://localhost:3000/) to see your site.<br>
3838
When you’re ready to deploy to production, create a minified bundle with `npm run build`.
3939

40-
## Creating a Site
40+
## Creating a new Site
4141

4242
**You’ll need to have Node 14.0.0 or later version on your local development machine** (but it’s not required on the server). We recommend using the latest LTS version. You can use [nvm](https://github.com/creationix/nvm#installation) (macOS/Linux) or [nvm-windows](https://github.com/coreybutler/nvm-windows#node-version-manager-nvm-for-windows) to switch Node versions between different projects.
4343

4444
To create a new site, you may choose one of the following methods:
4545

46-
### npx
46+
- ### npx
4747

48-
```sh
49-
npx create-docusaurus-openapi my-website
50-
```
48+
```sh
49+
npx create-docusaurus-openapi my-website
50+
```
5151

52-
_([npx](https://medium.com/@maybekatz/introducing-npx-an-npm-package-runner-55f7d4bd282b) is a package runner tool that comes with npm 5.2+ and higher)_
52+
_([npx](https://medium.com/@maybekatz/introducing-npx-an-npm-package-runner-55f7d4bd282b) is a package runner tool that comes with npm 5.2+ and higher)_
5353

54-
### npm
54+
- ### npm
5555

56-
```sh
57-
npm init docusaurus-openapi my-website
58-
```
56+
```sh
57+
npm init docusaurus-openapi my-website
58+
```
5959

60-
_`npm init <initializer>` is available in npm 6+_
60+
_`npm init <initializer>` is available in npm 6+_
6161

62-
### Yarn
62+
- ### yarn
6363

64-
```sh
65-
yarn create docusaurus-openapi my-website
66-
```
64+
```sh
65+
yarn create docusaurus-openapi my-website
66+
```
6767

68-
_[`yarn create <starter-kit-package>`](https://yarnpkg.com/lang/en/docs/cli/create/) is available in Yarn 0.25+_
68+
_[`yarn create <starter-kit-package>`](https://yarnpkg.com/lang/en/docs/cli/create/) is available in Yarn 0.25+_
6969

7070
It will create a directory called `my-website` inside the current folder.<br>
7171
Inside that directory, it will generate the initial project structure and install the transitive dependencies:
@@ -124,6 +124,37 @@ Builds the site for production to the `build` folder.
124124

125125
Docusaurus is a modern static website generator that will build the website into a directory of static contents, which can be copied to any static file hosting service like [GitHub pages](https://pages.github.com/), [Vercel](https://vercel.com/) or [Netlify](https://www.netlify.com/).
126126

127+
## Add to an existing Site
128+
129+
1. Install the dependency
130+
131+
```sh
132+
npm install docusaurus-preset-openapi
133+
```
134+
135+
2. Edit your `docusaurus.config.js` file to use this preset
136+
```js
137+
presets: [
138+
[
139+
"docusaurus-preset-openapi",
140+
/** @type {import('docusaurus-preset-openapi').Options} */
141+
{
142+
api: {
143+
path: "<PATH_TO_YOUR_OPENAPI_DOCUMENT>",
144+
routeBasePath: "/api",
145+
},
146+
docs: {
147+
sidebarPath: require.resolve("./sidebars.js"),
148+
routeBasePath: "/",
149+
},
150+
theme: {
151+
customCss: require.resolve("./src/css/custom.css"),
152+
},
153+
},
154+
],
155+
];
156+
```
157+
127158
## Popular Alternatives
128159

129160
Docusaurus OpenAPI is great for:

0 commit comments

Comments
 (0)