grunt-jsdoc is a Grunt plugin designed to integrate JSDoc 3 documentation generation directly into a Grunt build process. It acts as a wrapper around the JSDoc tool, allowing developers to define documentation sources and output destinations within their Gruntfile.js. The current stable version is 2.4.1. Releases are infrequent, typically occurring to update the underlying JSDoc dependency (e.g., for security patches) or address minor compatibility issues. Its key differentiator is its tight integration into the Grunt ecosystem, providing a task-runner-centric approach to documentation, as opposed to running JSDoc directly from the command line or using a different build tool.
npm install grunt-jsdocVerified import paths — ran on the pinned version, not inferred.
This quickstart demonstrates how to configure and run the `grunt-jsdoc` task, including how to use an external JSDoc template like `ink-docstrap`. It shows a complete `Gruntfile.js` and a basic JavaScript file with JSDoc comments for generation.
Install `ink-docstrap` separately: `npm install --save-dev ink-docstrap`.
Review JSDoc configurations for `private` option usage and set it explicitly to `true` if private members should be documented.
Ensure your Node.js environment meets the minimum requirement specified in the package's `engines` field (currently `'>= 8.12.0'`).
Explicitly set the `jsdoc` option in your Gruntfile to the full path of the JSDoc executable, e.g., `jsdoc: './node_modules/.bin/jsdoc'`.
Always keep `grunt-jsdoc` updated to the latest stable version to benefit from security patches in its dependencies.
Add `grunt.loadNpmTasks('grunt-jsdoc');` to your Gruntfile.js.Ensure `ink-docstrap` is installed (`npm install --save-dev ink-docstrap`) and the `template` and `configure` paths in your Gruntfile configuration correctly point to `node_modules/ink-docstrap/template`.
Add `destination: 'path/to/doc'` within the `options` object of your `jsdoc` task configuration in Gruntfile.js.
Explicitly set the `jsdoc` option to the path of the JSDoc binary, typically `jsdoc: './node_modules/.bin/jsdoc'`, or ensure JSDoc is correctly installed as a dependency.