mirror of
https://github.com/facebook/docusaurus.git
synced 2025-05-28 16:37:07 +02:00
feat(v2): generalize usage of _ prefix convention to exclude content files/folders (#5173)
* create a swizzleWarning partial for shared text * Generalize usage of _ prefix convention to exclude content files/folders * add api doc * MDX loader should not expect metadata/frontmatter on MDX partial files
This commit is contained in:
parent
0851e0e5bf
commit
8bdb3da233
40 changed files with 249 additions and 80 deletions
5
website/docs/_partials/swizzleWarning.mdx
Normal file
5
website/docs/_partials/swizzleWarning.mdx
Normal file
|
@ -0,0 +1,5 @@
|
|||
:::caution
|
||||
|
||||
We discourage swizzling of components during the Docusaurus 2 beta phase. The theme components APIs are likely to evolve and have breaking changes. If possible, stick with the default appearance for now.
|
||||
|
||||
:::
|
|
@ -72,6 +72,15 @@ module.exports = {
|
|||
*/
|
||||
routeBasePath: 'blog',
|
||||
include: ['*.md', '*.mdx'],
|
||||
/**
|
||||
* No route will be created for matching files
|
||||
*/
|
||||
exclude: [
|
||||
'**/_*.{js,jsx,ts,tsx,md,mdx}',
|
||||
'**/_*/**',
|
||||
'**/*.test.{js,jsx,ts,tsx}',
|
||||
'**/__tests__/**',
|
||||
],
|
||||
postsPerPage: 10,
|
||||
/**
|
||||
* Theme components used by the blog pages.
|
||||
|
|
|
@ -69,6 +69,15 @@ module.exports = {
|
|||
*/
|
||||
routeBasePath: 'docs',
|
||||
include: ['**/*.md', '**/*.mdx'], // Extensions to include.
|
||||
/**
|
||||
* No route will be created for matching files
|
||||
*/
|
||||
exclude: [
|
||||
'**/_*.{js,jsx,ts,tsx,md,mdx}',
|
||||
'**/_*/**',
|
||||
'**/*.test.{js,jsx,ts,tsx}',
|
||||
'**/__tests__/**',
|
||||
],
|
||||
/**
|
||||
* Path to sidebar configuration for showing a list of markdown pages.
|
||||
*/
|
||||
|
|
|
@ -39,11 +39,12 @@ module.exports = {
|
|||
routeBasePath: '',
|
||||
include: ['**/*.{js,jsx,ts,tsx,md,mdx}'],
|
||||
/**
|
||||
* No Route will be created for matching files
|
||||
* No route will be created for matching files
|
||||
*/
|
||||
exclude: [
|
||||
'**/_*.{js,jsx,ts,tsx,md,mdx}',
|
||||
'**/*.test.{js,ts}',
|
||||
'**/_*/**',
|
||||
'**/*.test.{js,jsx,ts,tsx}',
|
||||
'**/__tests__/**',
|
||||
],
|
||||
/**
|
||||
|
|
|
@ -93,11 +93,11 @@ For advanced minification of CSS bundle, we use the [advanced cssnano preset](ht
|
|||
|
||||
### `docusaurus swizzle [siteDir]` {#docusaurus-swizzle-sitedir}
|
||||
|
||||
:::caution
|
||||
```mdx-code-block
|
||||
import SwizzleWarning from "./_partials/swizzleWarning.mdx"
|
||||
|
||||
We discourage swizzling of components during the Docusaurus 2 beta phase. The theme components APIs are likely to evolve and have breaking changes. If possible, stick with the default appearance for now.
|
||||
|
||||
:::
|
||||
<SwizzleWarning/>
|
||||
```
|
||||
|
||||
Change any Docusaurus theme components to your liking with `npm run swizzle`.
|
||||
|
||||
|
|
|
@ -98,11 +98,11 @@ Use this component to render React Context providers and global stateful logic.
|
|||
|
||||
## Swizzling theme components {#swizzling-theme-components}
|
||||
|
||||
:::caution
|
||||
```mdx-code-block
|
||||
import SwizzleWarning from "./_partials/swizzleWarning.mdx"
|
||||
|
||||
We discourage swizzling of components during the Docusaurus 2 beta phase. The theme components APIs are likely to evolve and have breaking changes. If possible, stick with the default appearance for now.
|
||||
|
||||
:::
|
||||
<SwizzleWarning/>
|
||||
```
|
||||
|
||||
Docusaurus Themes' components are designed to be replaceable. To make it easier for you, we created a command for you to replace theme components called `swizzle`.
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue