[Grunt & Yeoman] grunt-contrib-yuidoc で JavaScript のドキュメントを生成する
grunt-contrib-yuidoc は、JavaScript のドキュメント生成ツール。
[markdown]
## インストール
> * [gruntjs/grunt-contrib-yuidoc · GitHub](https://github.com/gruntjs/grunt-contrib-yuidoc)
“`prettyprinted
% npm install grunt-contrib-yuidoc –save-dev
“`
## Gruntfile
オプション。
> * [Using YUIDoc](http://yui.github.io/yuidoc/args/index.html)
> * [Gruntfileを整理してタスクの自動化を進めた ::ハブろぐ](http://havelog.ayumusato.com/develop/javascript/e514-grunt_arrange_task.html)
“`
# grunt-contrib-yuidoc
yuidoc:
compile:
name: ‘<%= pkg.name %>‘
description: ‘<%= pkg.description %>‘
version: ‘<%= pkg.version %>‘
url: ‘<%= pkg.homepage %>‘
options:
paths: ‘src/javascripts/’
outdir: ‘docs/YUIDoc’
“`
## つかいかた
コメントを書く。
> * [YUIDoc – Javascript Documentation Tool](http://yui.github.io/yuidoc/)
> * [JavaScriptのAPIドキュメント生成ツール YUIDocがいい感じ | kudox.jp](http://kudox.jp/java-script/yuidoc-js-document)
“`
/**
* This is the description for my class.
*
* @class MyClass
* @constructor
*/
function hoge() {
“use strict”;
var foo = ” hoge fuga”;
console.log(foo);
}
hoge();
“`
“`prettyprinted
% grunt yuidoc
Running “yuidoc:compile” (yuidoc) task
Start YUIDoc compile…
Scanning: ./src/javascripts/
Output: docs/YUIDoc
YUIDoc compile completed in 0.195 seconds
Done, without errors.
“`
“`prettyprinted
% open docs/YUIDoc/index.html
“`
[/markdown]