Generating Documentation
Learn how to generate documentation for Ionic projects using Compodoc and SassDoc.
We'll cover the following...
Configuring publishing settings
To publish our documented code, we need to run both the Compodoc and SassDoc utilities from the command line using NPM.
Fortunately, we can embed and configure a task within the package.json
file to publish the TypeScript and Sass documentation for the animations-app
project. This will then be run from the command line.
Within the scripts
section of the package.json
file for the animations-app
project, enter the following configuration (some lines have been removed for readability):
"scripts": {
// ...
"docs": "./node_modules/.bin/compodoc -p ./tsconfig.json -d ./documentation/jsdocs -n \"AnimationApp Docs\" -e html && sassdoc ./src/theme/app.mixins.scss -d ./documentation/sassdoc"
},
Here, we’ve introduced a script named docs
(pretty imaginative name, huh?) which runs both the Compodoc and SassDoc utilities using the following command line instructions:
- The
./node_modules/.bin/compodoc
command is a path to the Compodoc utility. - The
-p ./tsconfig.json
command is a command-line flag indicating the