Skip to content

Commit

Permalink
docs(v2): improve cli docs (#4259)
Browse files Browse the repository at this point in the history
* added more details about --danger flag for swizzle

* added referencing to blog posts

* improved the docs for swizzling.

* added new Farsi/Persian translation

* Update website/docs/cli.md

* Update website/docs/cli.md

* Update website/docs/using-themes.md

* PR cleanup

Co-authored-by: Sébastien Lorber <slorber@users.noreply.github.com>
Co-authored-by: slorber <lorber.sebastien@gmail.com>
  • Loading branch information
3 people committed Feb 22, 2021
1 parent f750660 commit 704df68
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 7 deletions.
22 changes: 17 additions & 5 deletions website/docs/cli.md
Expand Up @@ -92,18 +92,18 @@ We highly discourage swizzling of components until we've reached a Beta stage. T

:::

Change any Docusaurus theme components to your liking with `docusaurus swizzle`.
Change any Docusaurus theme components to your liking with `npm run swizzle`.

```shell
docusaurus swizzle [themeName] [componentName] [siteDir]
```bash npm2yarn
npm run swizzle [themeName] [componentName] [siteDir]

# Example (leaving out the siteDir to indicate this directory)
docusaurus swizzle @docusaurus/theme-classic DocSidebar
npm run swizzle @docusaurus/theme-classic DocSidebar
```

Running the command will copy the relevant theme files to your site folder. You may then make any changes to it and Docusaurus will use it instead of the one provided from the theme.

`docusaurus swizzle` without `themeName` lists all the themes available for swizzling similarly `docusaurus swizzle <themeName>` without `componentName` lists all the components available for swizzling.
`npm run swizzle` without `themeName` lists all the themes available for swizzling similarly `npm run swizzle <themeName>` without `componentName` lists all the components available for swizzling.

#### Options

Expand All @@ -114,6 +114,18 @@ Running the command will copy the relevant theme files to your site folder. You
| `--danger` | Allow swizzling of unstable components |
| `--typescript` | Swizzle TypeScript components |

An example to use `--danger` flag let's consider the below code:

```bash npm2yarn
npm run swizzle @docusaurus/theme-classic Logo -- --danger
```

:::caution

Unstable Components: components that have a higher risk of breaking changes due to internal refactorings.

:::

To unswizzle a component, simply delete the files of the swizzled component.

<!--
Expand Down
4 changes: 2 additions & 2 deletions website/docs/using-themes.md
Expand Up @@ -108,8 +108,8 @@ Docusaurus Themes' components are designed to be replaceable. To make it easier

To swizzle a component for a theme, run the following command in your doc site:

```shell
docusaurus swizzle <theme name> [component name]
```bash npm2yarn
npm run swizzle <theme name> [component name]
```

As an example, to swizzle the `<Footer />` component in `@docusaurus/theme-classic` for your site, run:
Expand Down

0 comments on commit 704df68

Please sign in to comment.