siteConfig

  • typedef
DocumentJS.siteConfig

{Object}

 

The configuration options within a docConfig's sites objects or sitesDefaults object.

Object

Properties

  1. glob="**/*.{js,md}" {String | GlobObject}Optional

    Configures the files that will be processed into documentation. The glob option either specifies a minmatch pattern like:

    {glob: "*.js"}
    

    Or a GlobObject that specifies the a minmatch pattern and other options like:

    {
      glob: {
        pattern: "*.js",
        cwd: __dirname,
        ignore: "{some_folder}/**/*" 
      }
    }
    

    By default the pattern "**/*.{js,md}" is used, which searches for all .js and .md files within the project. And the default ignore is "{node_modules,bower_components}/**/*" which ignores everything in the node_modules and bower_components folder.

  2. dest {String}Optional

    The location of the folder where DocumentJS should write the output. Locations should be relative to the parent folder of the documentjs.json file. If this is not provided, the site name of the configuration is used.

  3. parent {String}Optional

    The name of the docObject that will be shown at index.html. If one is not provided, one will be attempted to be found by:

    • Trying to find the docObject that is parent of every other docObject.
    • Trying to find the docObject that has the most children.

    If that fails, an "index" docObject might be created and set as the parent of every other docObject that does not have a parent.

  4. pageConfig {Object}Optional

    An object that is made availalbe to the generated HTML pages.

  5. static {String}

    The location of static content used to overwrite or add to the default static content.

  6. forceBuild=false {Boolean}Optional

    If set to true, rebuilds the static bundle even if it has already been built.

  7. minifyBuild=true {Boolean}Optional

    If set to false the build will not be minified. This behavior should be implemented by the "build" module.

  8. devBuild=false {Boolean}Optional

    If set to true the build will not be built so that individual files will be loaded. This behavior should be implemented by the "build" module.

  9. templates {String}Optional

    The location of templates used to overwrite or add to the default templates.

  10. tags {String}Optional

    A path to a module that determines which tags will be used to process the site. The module must export a function that takes the default tags object and returns the tags that will be used.

    Example use:

    tags: "./theme/tags"
    

    Example module:

    // theme/tags.js
    module.exports = function(defaultTags) {
        tags = _.extend({},defaultTags);
        tags.customTag = {add: function(){}, ...}
        return tags;
    };
    
  11. generators {moduleName | Array<moduleName>}Optional

    Generators specifies a generator module or array of modules used to create an output for documentation. The default generator is "html" which maps to documentjs's internal html generator.

    You can specify other modules which will be passed a promise containing the docMap and the options and be expected to return a promise that resolves when they are complete.

  12. singlePage=false {Boolean}Optional

    If true only a single HTML page will be written out. The parent docObject will be rendered with an additional .docMap property set to the docMap. If you set this, the default templates are not designed to work with this. Make sure you set templates to overwrite them.

Use

A siteConfig object configures a single call to generate. It specifies files to be converted to documentation and configures how the output should be generated. It looks like:

{
  glob: "*.js",
  dest: "../docs",
  templates: "theme/templates"
}

A siteConfig object is within a docConfig's sites or siteDefaults objects like:

{
  siteDefaults: {
    templates: "theme/templates"
  },
  sites: {
    "api": {
      glob: "*.js",
      dest: "../docs"
    }
  }
}