Code Monkey home page Code Monkey logo

gulp-node-slate's Introduction

logo
Slate helps you create beautiful, intelligent, responsive API documentation.
screenshot

gulp-node-slate

node-slate as a gulp task

npm   dependencies Status   Known Vulnerabilities   Build Status

A) Lightning quick demo

Don't have an existing gulp project? Just want to experiment with no commitment?

Blindly enter these commands:

$ 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.

B) Instructions

1. Install into your project:

$ npm install gulp-node-slate --save-dev

2. Add a task to your gulpfile.js:

const slate = require('gulp-node-slate');
function generateApiDocs() { return gulp.src([]).pipe(slate()); }
gulp.task('slate', generateApiDocs);

3. Build and view the API documentation:

$ 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

4. Get to work

Customize the files in the source folder to create your API documentation and then rerun gulp slate.

C) Configuration

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').

E) Notes

  1. If you want to contribute to the project, fork it and then run the spec-runner.sh.command script and examine the contents of the api-docs folder. Pull requests are welcome.
  2. If you have a question, suggestion, or bug to report, open an issue.

MIT License

gulp-node-slate's People

Contributors

dpilafian avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

gulp-node-slate's Issues

Don't require npm install node-slate if dep

I've already got node-slate added as a dep in my project but I this module keeps installing node-slate anyway.

➜  template git:(master) ✗ yarn add -D sdelements/node-slate
yarn add v1.3.2
[1/5] 🔍  Validating package.json...
[2/5] 🔍  Resolving packages...
[3/5] 🚚  Fetching packages...
[4/5] 🔗  Linking dependencies...
[5/5] 📃  Building fresh packages...
success Saved lockfile.
success Saved 1 new dependency.
└─ [email protected]
✨  Done in 37.36s.
➜  template git:(master) ✗ yarn gulp slate                  
yarn run v1.3.2
$ /Users/xo/code/lad/template/node_modules/.bin/gulp slate
[13:54:12] Using gulpfile ~/code/lad/template/gulpfile.js
[13:54:12] Starting 'slate'...
settings: { source: 'source', build: 'build' }
downloading...
npm install ./node_modules/node-slate

This should return the stream at end

Since this lib doesn't return the stream of files at the end of it's operation I end up piping my input file to my destination. Also by default the source should just use the dir from the slate in node_modules since it's required for this lib to run anyway.

  return gulp
    .src('swagger-api.md')
    .pipe(slate({
      source: 'docs'
    }))
    .pipe(gulp.dest('build/docs'));

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.