Installation

If you want to integrate SassDoc in a build process but do not use Grunt, Gulp or Broccoli, you can still use SassDoc with nothing but Node.

npm install sassdoc --save

Using raw data

If you are not interested in generating the documentation but only want to access the raw data, it is as easy as using the parse method accepting a folder (of Sass/SCSS files) and returning a promise yielding documented items.

It’s up to you to do whatever you want with this!

var sassdoc = require('sassdoc');

sassdoc.parse('./scss', { verbose: true })
  .then(function (data) {
    console.log(data);
  });

Generating documentation

Or if you want to use SassDoc at its best and generate the whole documentation from Node, you can use the default function.

var sassdoc = require('sassdoc');

sassdoc('./scss', { verbose: true })
  .then(function () {
    console.log('Your documentation has been generated!');
  }, function (err) {
    console.error(err);
  });

If you want to configure the destination directory, you can pass a custom dest in the configuration object.

Synopsis

Both sassdoc and sassdoc.parse functions have the same synopsis:

Streaming

There is one more way you can use these functions; if you ommit the source argument, you’ll get a transform stream, able to handle vinyl files. You can easily use it with vinyl-fs.

var vfs = require('vinyl-fs');
var sassdoc = require('sassdoc');

// Dump documentation in a directory.
vfs.src(source)
  .pipe(someFilter())
  .pipe(sassdoc());

// Get the raw data.
vfs.src(source)
  .pipe(sassdoc.parse())
  .on('data', function (data) {
    console.log(data);
  });

Note: that's why you don't need a plugin to use SassDoc with Gulp!

Find more examples and notes about the Stream API on the Gulp page.

About glob

The source parameter above can be a simple source directory, but also a glob expression or even array.

sassdoc(['scss/**/*.scss', '!scss/vendor/*.scss'], ...args);
sassdoc('scss/**/*.{sass,scss}', ...args);
sassdoc('scss/**/*.s[ac]ss', ...args);
sassdoc('scss/**/*.s?ss', ...args);