You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository was archived by the owner on Mar 16, 2026. It is now read-only.
Copy file name to clipboardExpand all lines: src/docs/documentation/references/migration-guide.mdx
+34-20Lines changed: 34 additions & 20 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1,17 +1,14 @@
1
-
---
2
-
name: Migration Guide
3
-
route: /docs/migration-guide
4
-
parent: Documentation
5
-
menu: References
6
-
---
7
-
8
1
# Migration Guide
9
-
The [v2 release](https://github.com/pedronauck/docz/pull/950) is our biggest release in terms of changes on our core scripts. Our bundler system was entirely modified in order to use Gatsby as default bundler and you will need to update your code if you’re coming from a previous version. It’s not a big deal, but you need to follow this guide in order to get Docz running properly on your project after the upgrade.
2
+
3
+
The [v2 release](https://github.com/pedronauck/docz/pull/950) is our biggest release in terms of changes to our core scripts. Our bundler system was entirely modified in order to use Gatsby as default bundler and you will need to update your code if you’re coming from a previous version.
4
+
5
+
It’s not a big deal, but you will need to follow this guide in order to get Docz running properly on your project after the upgrade.
10
6
11
7
## Gatsby as default bundler
12
-
The biggest change in the new v2 is that now our core is entirely build using Gatsby behind the scenes. This is a huge win for Docz, since now we can focus on build new features instead of handling with a lot of bundlers issues (our biggest bottleneck) and enjoy all Gatsby ecosystem.
13
8
14
-
So, in order to refactoring our core, we need to change a lot of things and remove others that no longer make sense. The most expressive changes here is about the configuration for `doczrc.js` and the plugin system.
9
+
The biggest change in the new v2 is that our core is now entirely built using Gatsby behind the scenes. This is a huge win for Docz, since now we can focus on building new features instead of handling a lot of bundlers issues (our biggest bottleneck) and leverage the entire Gatsby ecosystem.
10
+
11
+
So, in order to refactor our core, we need to change a lot of things and remove others that no longer make sense. The most expressive changes here is about the configuration for `doczrc.js` and the plugin system.
15
12
16
13
### List of removed properties from `doczrc.js`
17
14
***`websocketHost`** ▶︎ _no longer need_
@@ -37,29 +34,42 @@ The `createPlugin` method also changed in order to fit with Gatsby now.
37
34
***`onPreRender`** ▶︎ _removed_
38
35
***`onPostRender`** ▶︎ _removed_
39
36
40
-
> All methods that changed now are using the same API of Gatsby hooks.
37
+
> All methods that changed now are using the same API as Gatsby hooks.
41
38
> You can have more details about then [here](https://www.gatsbyjs.org/docs/node-apis).
42
39
43
40
## `docz-theme-default` removed
44
-
The main reason that made us change our core to use Gatsby is that now it have a feature called themes. In the last major version we launched our own `gatsby-theme-docz` and this was impressive since we could use Docz inside a Gatsby project and brings a lot of new possibilites when creating a documentation.
45
41
46
-
So, indeed we were using Gatsby theme at all, but in the wrong way. One of the best benefits of Gatsby theme are the feature called Component Shadowing, that’s the ability to replace theme files just by creating your own file following a file naming convention. This is awesome and is something that people always ask for me, like: “I want just to change the head in the Docz theme”.
42
+
Make sure to remove `docz-theme-default` from your dependencies when migrating :
The main reason that made us change our core to use Gatsby is that they have added a feature called themes.
49
+
50
+
In the last major version we launched our own Gatsby theme `gatsby-theme-docz` and this was a huge step forward because we can now use Docz inside a Gatsby project and bring a lot of new possibilities when creating documentation.
47
51
48
-
In order to get Docz running with component shadowing we removed `docz-theme-default` and now you don’t need to install it anymore. You can just add `docz` and your project is done.
52
+
One of the best benefits of Gatsby themes is a feature called Component Shadowing, that’s the ability to replace theme files just by creating your own file following a file naming convention. This is awesome and is something that people very often ask, for example: “I want just to change the head in the Docz theme”.
49
53
50
-
Check [here](h) readme for more information.
54
+
In order to get Docz running with component shadowing we removed `docz-theme-default` and now you don’t need to install it anymore. You can just add `docz` to your project.
55
+
56
+
Check [here](https://github.com/doczjs/docz/tree/master/core/gatsby-theme-docz#customizing-components) for more information about customizing the Gatsby theme.
51
57
52
58
### Code highlight with PrismJS
53
-
In the last version of Docz we’re using Codemirror to highlight code inside `<Playground>` and code blocks. Now we are using [prism-react-renderer](https://github.com/FormidableLabs/prism-react-renderer) together with Theme UI.
54
59
55
-
Check [here](h) for more information.
60
+
In the last version of Docz we used Codemirror to highlight code inside `<Playground>` and code blocks. Starting from v2 docz uses [prism-react-renderer](https://github.com/FormidableLabs/prism-react-renderer) together with Theme UI.
61
+
62
+
Check [here](https://github.com/FormidableLabs/prism-react-renderer) for more information.
56
63
57
64
### New `themeConfig` properties
58
-
Another great thing launched in the newest version is the integration with the [Theme UI](https://theme-ui.com). Theme UI it’s a library for build consistent, themeable React apps based on constraint-based design principles. So, in order to integration it with our new theme, a lot of changes are made inside the `themeConfig` object.
59
65
60
-
Check [here](h) for more information.
66
+
Another great thing launched in the newest version is the integration with [Theme UI](https://theme-ui.com). Theme UI is a library for building consistent, themeable React apps based on constraint-based design principles.
67
+
68
+
So, in order to integrate it with our new theme, a lot of changes have been made inside the `themeConfig` object.
69
+
61
70
62
71
## `theme` property removed
72
+
63
73
The property used to define your Docz theme inside the `doczrc.js` was removed. But you can still create and use your own theme from scratch if you want.
64
74
65
75
If you want to use your own theme, just create a file called `src/gatsby-theme-docz/index.js` in order to use component shadowing and replace it with your new theme.
CSS preprocessors and modules were handled by [`docz-plugin-css`](https://github.com/doczjs/docz-plugin-css) which hooked into the bundler config to add different loader support via webpack.
95
105
96
-
With the change to gatsbypreprocessors like `sass` can be handled by gatby via [Plugins](https://www.gatsbyjs.org/plugins/)
106
+
With the change to gatsby, css preprocessors like `sass` can be handled by gatsby via [Plugins](https://www.gatsbyjs.org/plugins/)
97
107
98
108
These plugins are added by adding a `gatsby-config.js` in your project root or modifying an existing one. For example if you want to add support for `sass` you would do the following:
99
109
@@ -113,3 +123,7 @@ module.exports = {
113
123
plugins: ['gatsby-plugin-sass']
114
124
}
115
125
```
126
+
127
+
## Examples
128
+
129
+
Make sure to check out [docz's `examples` directory](https://github.com/doczjs/docz/tree/master/examples) for the full list of supported examples.
0 commit comments