JSDoc的配置使用

1.安装grunt 1.10.0

2.安装grunt 1.0.0

3.在项目根目录下创建grunt配置文件

module.exports = function(grunt) {
    // 配置
    grunt.initConfig({
        jsdoc : {
            dist : {
                src: ['src/*.js'], 
                options: {
                    destination: 'doc'
                }
            }
        }
    });

      // 载入jsdoc插件,生成JS文档
      grunt.loadNpmTasks('grunt-jsdoc');

      // 注册任务
      grunt.registerTask('default', ['jsdoc']);
  };

4. 在根目录下运行 grunt

注意,安装grunt和grunt-jsdoc不要全局安装,要安装到项目内。否则不能运行grunt。还有一定要指定grunt-jsdoc的版本,因grunt-jsdoc最新版本需要grunt4.5+,而grunt4.5+需要更高的minimist。

posted @ 2017-03-31 08:35  烟台西炮台  阅读(482)  评论(0编辑  收藏  举报