Building your site

Now that you know about writing your docs, let's talk about how you can build and deploy your documentation. The first thing that you need to do is run the build script created in your package.json:

$ yarn docz:build

If everything goes well, this command will generate all static files for you in the .docz/dist folder and you will see something like this in your terminal:

Terminal output

With your static files in hand, you can deploy your documentation wherever you want just like you do with any static site.

Changing build folder

You can change the build destination folder by changing the dest prop on your project configuration:

// doczrc.js
export default {
  dest: '/my-dist-folder',
}

Changing base folder

If you are using something like GitHub Pages chances are that you are not deploying your site directly under the root of your user. For example if you have a docz-repository on your GitHub the URL for deploying that repository will be https://your-username.github.io/docz. You can specify in which subdirectory your files will be deployed with the base-property of doczrc.js.

// doczrc.js
export default {
  base: '/docz',
}

Using Netlify

If you understand nothing about deploys, we highly recommend that you use the service we're using to host this website that you're seeing, called Netlify. Netlify is a really fantastic and easy tool that allows you to deploy your application in an automatic way by running the deploy on every push from a branch in seconds.

First, after login or create a new account on Netlify, just create a New site from git:

Netlify create new site

Connect your Git service and pick some repository:

Netlify pick repository

After that, just fill settings like below, passing your build command and the destination folder:

Netlify add settings build command and destination directory

Finally, add a file netlify.toml to your project's root folder with the following contents:

# COMMENT: This a rule for Single Page Applications as Docz site is one
[[redirects]]
  from = "/*"
  to = "/"
  status = 200

That's all. Now you have your documentation hosted on a domain with a quick and easy deploy process configured.