Grunt task for generating Codo documentation
Codo is a documentation generator for CoffeeScript, see https://github.com/netzpirat/codo for more information.
This plugin requires Grunt ~1.0
If you haven't used Grunt before, be sure to check out the Getting Started guide, as it explains how to create a Gruntfile as well as install and use Grunt plugins. Once you're familiar with that process, you may install this plugin with this command:
npm install grunt-codo --save-dev
Once the plugin has been installed, it may be enabled inside your Gruntfile with this line of JavaScript:
grunt.loadNpmTasks('grunt-codo');
In your project's Gruntfile, add a section named codo
to the data object passed into grunt.initConfig()
.
grunt.initConfig({
codo: {
options: {
// Task-specific options go here.
},
your_target: {
// Target-specific file lists and/or options go here.
},
},
});
Codo expect to lookup for coffee
files into given folder, and a destination path to generate the documentation.
So, in your target, don't forget to add src
and dest
properties. The dest
property is optional, and is defaulting to "./doc"
.
Type: Boolean
Default value: true
Show stats about the documentation generation.
Type: String
Default value: "coffee"
Coffee files extension.
Type: String
(path)
Default value: target.dest
, or "./doc"
The documentation destination directory. If this option is given, it will overwrite the target's dest
parameter.
Type: String
Default value: theme
The theme to be used.
Type: String
Default value: "Codo"
The project name.
Type: String
Default value: "Documentation"
Documentation HTML Title.
Type: String
(path)
Default value: "README.md"
The README file used in documentation.
Type: Boolean
Default value: false
Supress warnings
Type: Boolean
Default value: false
Show parsing errors.
Type: Boolean
Default value: false
List undocumented objects.
Type: Boolean
Default value: false
Try to parse closure-like block comments.
Type: Boolean
Default value: false
Show privates.
Type: String
Default value: false
The Google Analytics ID.
Type: Array
of String
(path)
Default value: []
Extra files to add to the documentation. Markdown files will be parsed.
In this example, the default options are used to generate the documentation for the coffee files from the src
directory into the default ./doc
folder.
grunt.initConfig({
codo: {
src: [
'src'
]
},
});
In this example, custom options are used to generate the documentation from api controllers and models into the website/doc/api
folder. We also set names and title, include a license file, and ask the task to show us the undocumented objects, but not the stats of the generation.
grunt.initConfig({
codo: {
options:
name: "AwesomeProject"
title: "AwesomeProject API Documentation"
extra: [ "LICENSE-MIT" ]
undocumented: yes
stats: no
src: [
"src/controllers/api"
"src/models"
]
dest: "website/doc/api"
},
});
In lieu of a formal styleguide, take care to maintain the existing coding style. Add unit tests for any new or changed functionality. Lint and test your code using Grunt.
Copyright (c) 2014 Johannes Stein
Licensed under the MIT license.