diff --git a/create/reusable-snippets.mdx b/create/reusable-snippets.mdx index 81d0d71ba..5d5fb540f 100644 --- a/create/reusable-snippets.mdx +++ b/create/reusable-snippets.mdx @@ -8,11 +8,11 @@ One of the core principles of software development is DRY (Don't Repeat Yourself Snippets do not render as standalone pages. You must import them into other files. -## Configure snippet folders +## Configure snippet locations -By default, any file in a folder named `snippets` is treated as a snippet. You can configure additional custom folders to contain snippets with the `snippets` field in your `docs.json`. +By default, any file in a folder named `snippets` is treated as a snippet. You can place snippets anywhere in your project by configuring custom locations with the `snippets` field in your `docs.json`. -Add [glob patterns](https://code.visualstudio.com/docs/editor/glob-patterns) to the `snippets` array in `docs.json` to specify which folders contain snippets. +Add [glob patterns](https://code.visualstudio.com/docs/editor/glob-patterns) to the `snippets` array in `docs.json` to specify which folders or files should be treated as snippets. The default `/snippets/` folder remains supported even when you add custom patterns. ```json docs.json { @@ -24,6 +24,12 @@ Add [glob patterns](https://code.visualstudio.com/docs/editor/glob-patterns) to } ``` +In this example: +- All files in the `components` folder and its subfolders are snippets +- All files in the `shared/reusable` folder and its subfolders are snippets +- The specific file `shared/common-component.mdx` is a snippet +- Files in the default `/snippets/` folder are still snippets + ## Create snippets Create a file in a snippet folder with the content you want to reuse. Snippets can contain all content types supported by Mintlify and they can import other snippets.