all files / packages/website/ index.js

100% Statements 12/12
100% Branches 0/0
100% Functions 4/4
100% Lines 12/12
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66                                                                                                            
var Package = require('dgeni').Package;
var path = require('path');
 
/**
 * @dgPackage website
 * @description Package builds web app with generated docs
 */
module.exports = new Package('website', [require('../navigation'), require('../search')])
 
  // Add in the real processors for this package
  .processor(require('./processors/computePaths'))
  .processor(require('./processors/config'))
  .processor(require('./processors/website'))
 
  // add more templates location and matching patterns
  .config(function(templateFinder) {
    templateFinder.templateFolders.unshift(path.resolve(__dirname, 'templates'));
 
    templateFinder.templatePatterns = templateFinder.templatePatterns.concat([
      'website/data/${ doc.id }.template.js',
      'website/${ doc.name }.template.js',
      '${ doc.area }/${ doc.docType }.template.js',
      '${ doc.area }/${ doc.name }'
    ]);
  })
 
  // add more tags
  .config(function(parseTagsProcessor, getInjectables) {
    getInjectables(require('./tag-defs')).forEach(function(v) {
      parseTagsProcessor.tagDefinitions.push(v);
    });
  })
 
  // adding more templates to computePathsProcessor configuration
  .config(function(computePathsProcessor) {
    computePathsProcessor.pathTemplates.push({
      docTypes: ['website'],
      pathTemplate: '${docType}/${name}',
      outputPathTemplate: '${id}'
    });
 
    computePathsProcessor.pathTemplates.push({
      docTypes: ['nav-data'],
      pathTemplate: 'web-data/template.js',
      outputPathTemplate: 'data/${id}.js'
    });
 
    computePathsProcessor.pathTemplates.push({
      docTypes: ['search-data'],
      pathTemplate: 'web-data/template.js',
      outputPathTemplate: 'data/${id}.js'
    });
 
    computePathsProcessor.pathTemplates.push({
      docTypes: ['search-data-index'],
      pathTemplate: 'web-data/template.js',
      outputPathTemplate: 'data/${name}'
    });
 
    computePathsProcessor.pathTemplates.push({
      docTypes: ['config-data'],
      pathTemplate: 'web-data/template.js',
      outputPathTemplate: '${name}'
    });
  })
;