Kingalione
Kingalione

Reputation: 4265

angularjs create documentation via grunt and ngdocs

Hello I'm trying to create a documentation for my ionicframework/angularjs application via grunt and ngdoc.

I've installed everything like preferred in http://gruntjs.com/getting-started

Well if I now run grunt

I get:

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.

And with that I can't show the docs.

My gruntfile is looking like this:

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

};

I'm new in creating docs for angularjs so what is the best practice for that purpose?

Upvotes: 2

Views: 201

Answers (1)

David Moore
David Moore

Reputation: 48

When you just use 'grunt' from the command line, it will attempt to run every task in the Gruntfile.js.

You want to just run ngdocs, so you should use grunt ngdocs as the command line command.

You've also added a task called 'build', which just runs ngdocs, so you can also use: grunt build

Upvotes: 1

Related Questions