Joan Yin
Joan Yin

Reputation: 81

which one should I use, grunt-ngdoc or grunt-ngdocs to generate the api and tutorial doc for my angularjs app?

There are 2 grunt plugins for generating docs for Angularjs applications.

https://www.npmjs.org/package/grunt-ngdoc

https://www.npmjs.org/package/grunt-ngdocs

What's the difference and which one should I use?

grunt-ngdoc


    ngdoc: {
      options: {
        dest: 'docs'
        scripts: ['../app.min.js'],
        html5Mode: true,
        startPage: '/api',
        title: 'My Documentation',
        analytics: {
              account: 'UA-08150815-0',
              domainName: 'my-domain.com'
        },
        discussions: {
              shortName: 'my',
              url: 'http://my-domain.com',
              dev: false
        }
      },
      tutorial: {
        src: ['content/tutorial/*.ngdoc'],
        title: 'Tutorial'
      },
      api: {
        src: ['src/**/*.js', '!src/**/*.spec.js'],
        title: 'API Documentation'
      }
    }

ngdocs


    ngdocs: {
      options: {
        dest: 'docs'
        scripts: ['../app.min.js'],
        html5Mode: true,
        startPage: '/api',
        title: "My Awesome Docs",
        image: "path/to/my/image.png",
        imageLink: "http://my-domain.com",
        titleLink: "/api",
        bestMatch: true,
        analytics: {
              account: 'UA-08150815-0',
              domainName: 'my-domain.com'
        },
        discussions: {
              shortName: 'my',
              url: 'http://my-domain.com',
              dev: false
        }
      },
      tutorial: {
        src: ['content/tutorial/*.ngdoc'],
        title: 'Tutorial'
      },
      api: {
        src: ['src/**/*.js', '!src/**/*.spec.js'],
        title: 'API Documentation'
      }
    }

Upvotes: 3

Views: 5365

Answers (4)

Anja Ishmukhametova
Anja Ishmukhametova

Reputation: 1564

package grunt-ngdocs https://github.com/m7r/grunt-ngdocs works fine (but long time haven't updated)

for ng1.6 works for me:

ngdocs: {
  all: ['app/**/*.js']
}

you will see the old version of angular 1.2.* in

cat docs/js/angular.min.js  | grep v1
 AngularJS v1.2.16

but it does not affect your source files.

dont forget run server

e.g using python

pushd ./dist; python -m SimpleHTTPServer 9000; popd #v 2.*
pushd ./dist; python -m http.server 9000; popd #v 3.*

Upvotes: 0

dnozay
dnozay

Reputation: 24324

Well, the AngularJS wiki does have some information about how to write documentation: https://github.com/angular/angular.js/wiki/Writing-AngularJS-Documentation

The flavour of jsdoc used by AngularJS is called ngdoc and is parsed by a Node.js utility called Dgeni.

More info about Dgeni here: https://github.com/angular/dgeni

Upvotes: 1

Selah
Selah

Reputation: 8064

I wondered the same thing today. I noticed ngdocs https://github.com/m7r/grunt-ngdocs was undergoing more active development than ngdoc https://github.com/bevacqua/grunt-ngdoc. As a result I decided to go with ngdocs.

UPDATE: I tried both and was able to get ngdocs working for my project, but was not able to get ngdoc working.

Upvotes: 14

przno
przno

Reputation: 3504

There is also grunt-docular to generate documentation in AngularJS' style. But with no activity for months :( To me it looks angular team did some improvements since then, but only for their internal use

Upvotes: 1

Related Questions