【问题标题】:angularjs create documentation via grunt and ngdocsangularjs 通过 grunt 和 ngdocs 创建文档
【发布时间】:2016-06-24 04:18:09
【问题描述】:

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

我已经在http://gruntjs.com/getting-started 中安装了所有喜欢的东西

如果我现在运行 grunt

我明白了:

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.

因此我无法显示文档。

我的 gruntfile 看起来像这样:

/*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']);

};

我是为 angularjs 创建文档的新手,那么为此目的的最佳做法是什么?

【问题讨论】:

    标签: angularjs gruntjs ngdoc grunt-ngdocs


    【解决方案1】:

    当您只在命令行中使用“grunt”时,它会尝试运行 Gruntfile.js 中的每个任务。

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

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

    【讨论】:

      猜你喜欢
      • 2014-09-13
      • 1970-01-01
      • 1970-01-01
      • 2012-03-15
      • 1970-01-01
      • 2014-08-23
      • 2015-02-01
      • 1970-01-01
      • 2015-10-21
      相关资源
      最近更新 更多