【问题标题】:Why does ngdocs generate 0 files?为什么ngdocs会生成0个文件?
【发布时间】:2014-06-14 07:02:30
【问题描述】:

我已经建立了一个非常简单的项目来测试 grunt-ngdocs (https://www.npmjs.org/package/grunt-ngdocs)。但是,当我尝试生成文档时,它无法识别任何 cmets。为什么?!救命!

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;
};

控制台输出:

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

Done, without errors.

【问题讨论】:

  • 跟jsdoc有什么关系?
  • ngDoc 建立在 jsdoc 之上,语法非常相似
  • 澄清一下,我认为ngDoc是jsdoc的超级定制版

标签: javascript gruntjs jsdoc


【解决方案1】:

我将 someCode.js 修改为如下,然后就可以了!

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;
};

【讨论】:

  • 问题是缺少描述。 ngdocs 需要参数类型、名称和描述。
猜你喜欢
  • 2020-02-05
  • 2023-01-18
  • 1970-01-01
  • 2020-01-28
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2013-12-06
  • 1970-01-01
相关资源
最近更新 更多