Class: KssGenerator

KssGenerator

new KssGenerator(version, options)

Create a KssGenerator object.

This is the base object used by all kss-node generators. Implementations of KssGenerator MUST pass the version parameter. kss-node will use this to ensure that only compatible generators are used.

var KssGenerator = require('kss/generator');
var customGenerator = new KssGenerator('2.0');
Parameters:
Name Type Description
version string

The generator API version implemented.

options object

The Yargs options this generator has. See https://github.com/bcoe/yargs/blob/master/README.md#optionskey-opt

Source:

Methods

checkGenerator()

Checks the generator configuration.

An instance of KssGenerator MUST NOT override this method. A process controlling the generator should call this method to verify the specified generator has been configured correctly.

Source:

clone(templatePath, destinationPath)

Clone a template's files.

This method is fairly simple; it copies one directory to the specified location. An instance of KssGenerator does not need to override this method, but it can if it needs to do something more complicated.

Parameters:
Name Type Description
templatePath string

Path to the template to clone.

destinationPath string

Path to the destination of the newly cloned template.

Source:

generate(styleguide)

Generate the HTML files of the style guide given a KssStyleguide object.

This the callback function passed to the parse() method. The callback is wrapped in a closure so that it has access to "this" object (the methods and properties of KssExampleGenerator.)

Parameters:
Name Type Description
styleguide KssStyleguide

The KSS style guide in object format.

Source:

init(config)

Initialize the style guide creation process.

This method is given a configuration JSON object with the details of the requested style guide generation. The generator can use this information for any necessary tasks before the KSS parsing of the source files.

Parameters:
Name Type Description
config Array

Array of configuration for the requested generation.

Source:

parse(callback)

Parse the source files for KSS comments and create a KssStyleguide object.

When finished, it passes the completed KssStyleguide to the given callback.

Parameters:
Name Type Description
callback function

Function that takes a KssStyleguide and generates the HTML files of the style guide.

Source: