Selah
Selah

Reputation: 8064

Why does ngdocs generate 0 files?

I have set up an extremely simple project to test out grunt-ngdocs (https://www.npmjs.org/package/grunt-ngdocs). However, when I try to generate documentation, it does not recognize any comments. Why?! Help!

Gruntfile.js

module.exports = function(grunt) {

  // Project configuration.
  grunt.initConfig({
    ngdocs: {
      options:{dest: 'docs'},
      api:{
        src:['someCode.js'],
        title:'API Documentation'
      }
    }
  });

  // Load the plugin that provide tasks.
  grunt.loadNpmTasks('grunt-ngdocs');

};

someCode.js

/**
 *
 * This is a sample function
 * @param x
 * @returns {number}
 */
var myFunc = function(x){
  return 2*x;
};

Console output:

slc058:ngDocPlay selah$ grunt ngdocs
Running "ngdocs:api" (ngdocs) task
Generating Documentation...
DONE. Generated 0 pages in 7ms.

Done, without errors.

Upvotes: 3

Views: 1340

Answers (1)

Selah
Selah

Reputation: 8064

I modified someCode.js to be the following and then it worked!

someCode.js

/**
 * @ngdoc function
 * @name myFunc
 * @description
 * This is a sample function
 * @param {number} x - any number, don't matter which
 */
var myFunc = function(x){
  return 2*x;
};

Upvotes: 2

Related Questions