mirror of
https://github.com/ionic-team/ionic-framework.git
synced 2026-03-13 10:22:08 +08:00
Main changes: * Use gulpfile now (build was getting way too disorganized with custom tasks; gulpfiles are much easier to build clean custom tasks with than Grunt. * View README#Development for updated commands * Docs written for ionContent, ionHeaderBar, ionInfiniteScroll. * Docs are pushed to ajoslin's fork of ionic-site until they reach a * point where they can be published. **TODO, In Order of Priority** 1. Finish writing source-documentation for all existing components 2. Add multiple versions of docs (one per release & nightly, latest stable release docs being shown by default) 3. Add examples generation 4. Add searchbar to docs
43 lines
1.1 KiB
JavaScript
43 lines
1.1 KiB
JavaScript
var _ = require('lodash');
|
|
var log = require('winston');
|
|
var path = require('canonical-path');
|
|
var deployment;
|
|
|
|
module.exports = {
|
|
name: 'index-page',
|
|
runAfter: ['adding-extra-docs'],
|
|
runBefore: ['extra-docs-added'],
|
|
description: 'This processor creates docs that will be rendered as the index page for the app',
|
|
init: function(config) {
|
|
deployment = config.deployment;
|
|
if ( !deployment || !deployment.environments ) {
|
|
throw new Error('No deployment environments found in the config.');
|
|
}
|
|
},
|
|
process: function(docs) {
|
|
|
|
// Collect up all the areas in the docs
|
|
var areas = {};
|
|
_.forEach(docs, function(doc) {
|
|
if ( doc.area ) {
|
|
areas[doc.area] = doc.area;
|
|
}
|
|
});
|
|
areas = _.keys(areas);
|
|
|
|
_.forEach(deployment.environments, function(environment) {
|
|
|
|
var indexDoc = _.defaults({
|
|
docType: 'indexPage',
|
|
areas: areas
|
|
}, environment);
|
|
|
|
indexDoc.id = 'index' + (environment.name === 'default' ? '' : '-' + environment.name);
|
|
// Use .. to put it at the root of the build
|
|
indexDoc.outputPath = indexDoc.id + '.html';
|
|
|
|
docs.push(indexDoc);
|
|
});
|
|
}
|
|
};
|