I worked with jsdocs.
This assumes that I have a folder structure:
gulp/
tasks/
utils/
index.js
README.md
config.js
src/
gulpfile.js
package.json
bower.json
The gulp task folder contains any gulp:
gulp docs.
gulp/tasks/_documentation.js
:
'use strict';
var gulp = require('gulp'),
runSequence = require('run-sequence'),
browserSync = require('browser-sync'),
jsdoc = require('gulp-jsdoc');
function Docs() {
var docs = {
options: {
srcFiles: ["./gulp/README.md", "./gulp/config.js", "./gulp/tasks/*.js"],
destination: './doc/jsdoc/'
},
bundle: function() {
gulp.task('docs', function(cb) {
return runSequence(
'docs:build',
'docs:serve',
cb
);
});
},
build: function() {
var options = this.options;
var destination = options.destination;
var template = {
path : 'ink-docstrap',
theme : 'flatly'
};
gulp.task('docs:build', function() {
gulp.src(options.srcFiles)
.pipe(jsdoc.parser())
.pipe(jsdoc.generator(destination, template))
});
},
serve: function() {
var options = this.options;
gulp.task('docs:serve', function() {
return browserSync.init({
open: true,
server: {
baseDir: options.destination,
},
ghostMode: {
links: false
}
});
});
}
};
return docs;
}
module.exports = Docs();
jsDocs, , _documentation.js.
gulp docs
, , - Modularized → .