Slate helps you create beautiful, intelligent, responsive API documentation.
node-slate as a gulp task
Don't have an existing gulp project? Just want to experiment with no commitment?
$ mkdir my-api-docs
$ cd my-api-docs
$ npm init --yes
$ npm install gulp@4 --save-dev
$ npm install gulp-node-slate --save-dev
$ cat > gulpfile.js << EOF
const gulp = require('gulp');
const slate = require('gulp-node-slate');
function generateApiDocs() { return gulp.src('.').pipe(slate()); }
gulp.task('slate', generateApiDocs);
EOF
$ node node_modules/gulp/bin/gulp.js slate
$ open build/index.html
Otherwise, follow the steps below.
$ npm install gulp-node-slate --save-dev
const slate = require('gulp-node-slate');
function generateApiDocs() { return gulp.src([]).pipe(slate()); }
gulp.task('slate', generateApiDocs);
$ gulp slate
$ ls source
$ open build/index.html
The structure of the generated source
folder is:
source/
images/
logo.png
includes/
*.md
custom.scss
index.yml
Customize the files in the source
folder to create your API documentation
and then rerun gulp slate
.
Example of passing in options:
.pipe(slate({ source: 'api-docs/input', build: 'api-docs/output' }))
Options:
source
– Relative path to the Slate API documentation input folder (default: 'source'
).build
– Relative path to the Slate API documentation output folder (default: 'build'
).spec-runner.sh.command
script and examine the contents of the api-docs
folder. Pull requests are welcome.