angularjs通过grunt和ngdocs创建文档

angularjs通过grunt和ngdocs创建文档,angularjs,gruntjs,ngdoc,grunt-ngdocs,Angularjs,Gruntjs,Ngdoc,Grunt Ngdocs,您好,我正在尝试通过grunt和ngdoc为我的ionicframework/angularjs应用程序创建文档 我已经安装了像preferred一样的所有东西 好吧,如果我现在跑呼噜 我得到: Running "jshint:gruntfile" (jshint) task >> 1 file lint free. Running "jshint:lib_test" (jshint) task >> 0 files linted. Please check your

您好,我正在尝试通过grunt和ngdoc为我的ionicframework/angularjs应用程序创建文档

我已经安装了像preferred一样的所有东西

好吧,如果我现在跑呼噜

我得到:

Running "jshint:gruntfile" (jshint) task
>> 1 file lint free.

Running "jshint:lib_test" (jshint) task
>> 0 files linted. Please check your ignored files.

Running "qunit:files" (qunit) task
Warning: 0/0 assertions ran (0ms) Use --force to continue.

Aborted due to warnings.
这样我就不能显示文档了

我的Grunfile看起来像这样:

/*global module:false*/
module.exports = function(grunt) {

  // Project configuration.
  grunt.initConfig({
    // Task configuration.
    jshint: {
      options: {
        curly: true,
        eqeqeq: true,
        immed: true,
        latedef: true,
        newcap: true,
        noarg: true,
        sub: true,
        undef: true,
        unused: true,
        boss: true,
        eqnull: true,
        browser: true,
        globals: {
          jQuery: true
        }
      },
      gruntfile: {
        src: 'Gruntfile.js'
      },
      lib_test: {
        src: ['lib/**/*.js', 'test/**/*.js']
      }
    },
    qunit: {
      files: ['test/**/*.html']
    },

    ngdocs: {
      all: ['src/resources/js/*.js']
    },

    watch: {
      gruntfile: {
        files: '<%= jshint.gruntfile.src %>',
        tasks: ['jshint:gruntfile']
      },
      lib_test: {
        files: '<%= jshint.lib_test.src %>',
        tasks: ['jshint:lib_test', 'qunit']
      }
    }
  });

  // These plugins provide necessary tasks.
  grunt.loadNpmTasks('grunt-contrib-qunit');
  grunt.loadNpmTasks('grunt-contrib-jshint');
  grunt.loadNpmTasks('grunt-contrib-watch');
  grunt.loadNpmTasks('grunt-ngdocs');

  // Default task.
  grunt.registerTask('default', ['jshint', 'qunit']);

  grunt.registerTask('build','Build the application',['ngdocs']);

};
/*全局模块:false*/
module.exports=函数(grunt){
//项目配置。
grunt.initConfig({
//任务配置。
jshint:{
选项:{
柯莉:是的,
Eqeq:是的,
伊梅德:没错,
拉特德:是的,
纽卡普:没错,
诺格:没错,
sub:没错,
是的,
没有使用过:是的,
老板:是的,
eqnull:true,
浏览器:是的,
全球:{
jQuery:true
}
},
Grunfile:{
src:'Gruntfile.js'
},
lib_测试:{
src:['lib/***/.js','test/***/.js']
}
},
昆特:{
文件:['test/***/.html']
},
ngdocs:{
全部:['src/resources/js/*.js']
},
观察:{
Grunfile:{
文件:“”,
任务:['jshint:gruntfile']
},
lib_测试:{
文件:“”,
任务:['jshint:lib_test','qunit']
}
}
});
//这些插件提供了必要的任务。
grunt.loadNpmTasks(“grunt-contrib-qunit”);
grunt.loadNpmTasks('grunt-contrib-jshint');
grunt.loadNpmTasks(“grunt-contrib-watch”);
grunt.loadNpmTasks(“grunt-ngdocs”);
//默认任务。
registerTask('default',['jshint','qunit']);
registerTask('build','buildtheapplication',['ngdocs']);
};

我在为angularjs创建文档方面是新手,那么最好的做法是什么呢?

当您从命令行使用“grunt”时,它将尝试运行GrunFile.js中的每个任务

您只想运行ngdocs,因此应该使用
grunt ngdocs
作为命令行命令

您还添加了一个名为“build”的任务,它只运行ngdocs,因此您还可以使用:
grunt build