首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >angularjs通过grunt和ngdocs创建文档。

angularjs通过grunt和ngdocs创建文档。
EN

Stack Overflow用户
提问于 2015-11-10 10:51:58
回答 1查看 197关注 0票数 2

你好,我正试图通过grunt和ngdoc为我的ionicframework/angularjs应用程序创建一个文档。

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

好吧,如果我现在咕哝

我得到:

代码语言:javascript
复制
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.

所以我不能给医生看。

我的文件看起来是这样的:

代码语言:javascript
复制
/*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创建文档,那么实现这个目的的最佳实践是什么呢?

EN

回答 1

Stack Overflow用户

回答已采纳

发布于 2016-06-23 20:18:09

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

您希望只运行ngdocs,所以应该使用grunt ngdocs作为命令行命令。

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

票数 1
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/33628324

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档