/
githubmirror
/
angular.js
Обзор
Документация
Войти
/
githubmirror
/
angular.js
Код
Запросы
0
Пакеты
0
Релизы
0
Аналитика
Безопасность
master
docs/config/processors/index-page.js
42 строки
988 B
Martin Staffa
revert: chore(docs-app): load example files based on active deployment
23 авг 2017, 12:52
23 авг 2017, 12:52
48f0957
Код
Авторство
О чём код?
'use strict'; var _ = require('lodash'); /** * @dgProcessor generateIndexPagesProcessor * @description * This processor creates docs that will be rendered as the index page for the app */ module.exports = function generateIndexPagesProcessor() { return { deployments: [], $validate: { deployments: { presence: true } }, $runAfter: ['adding-extra-docs'], $runBefore: ['extra-docs-added'], $process: function(docs) { // Collect up all the areas in the docs var areas = {}; docs.forEach(function(doc) { if (doc.area) { areas[doc.area] = doc.area; } }); areas = _.keys(areas); this.deployments.forEach(function(deployment) { var indexDoc = _.defaults({ docType: 'indexPage', areas: areas }, deployment); indexDoc.id = 'index' + (deployment.name === 'default' ? '' : '-' + deployment.name); docs.push(indexDoc); }); } }; };