/javascript-grunt-jsdoc-ng

Grunt task to run jsDoc without Java.

Primary LanguageJavaScript

Grunt JsDoc NG

This is a very simple wrapper to JSDoc for Grunt, without any need to have Java installed.

Installation and usage

Use NPM to install this:

npm install --save-dev grunt-jsdoc-ng

Load the task as any other Grunt plugin:

grunt.loadNpmTasks('grunt-jsdoc-ng');

And the configure the task normally:

'jsdoc-ng' : {
  'mysubtaskname' : {
    src: ['src/*.js', 'README.md' ],
    dest: 'docs',
    template : 'jsdoc-ng',
    options: {
      // ...
    }
  }
}

The various configuration options are:

  • src: The usual list of sources like any other Grunt task
  • dest: The destination directory where documents will be written to.
  • template:
    • Leave empty (or use the keyword default) for the standard JSDoc template.
    • Use the keyword jsdoc-ng for my built-in, Angular JS based template.
    • Specify any path to a template directory (where publish.js resides).
  • options: Anything recognized by JSDoc as a configuration (basically, the contents of your conf.json as specified here.

Embedded template

While the Angular JS doesn't expose all the functionalities of JSDoc, it's good enough (at least for me) for normal usage.

A couple of extra options can be configured in the templates section of the configuration:

  • windowTitle: The nice title for the API to produce.
  • minify: (default: true) If false HTML and JavaScript will not be minified.

See Gruntfile.js for an example on of how to use them.