Build time
The build-time configuration file is located in the configuration-path folder.
This file runs under a nodejs process and some functionlity is limited (e.g. typescript).
Possible names for the file:
buildtime.js
build.js
main.js
Name | Type | Description |
---|---|---|
categories | DocType[] | page types that are considered as categories fields as well |
pages | PagesOnlyRoutes | base url path for API documentation pages. |
stories or files | string | string[] |
ignore | string[] | files to ignore while building the site, in lowercase. Defaults to ['readme.md', 'changelog.md', 'code_of_conduct.md', 'contributing.md', 'license.md',] |
webpack or finalWebpack | WebpackConfig | custom webpack configuration setup. One or the other will be used |
siteRoot | string | the site base url, by default the site starts at / |
siteMap | { pages?: { home: SitemapConfigPage; index: SitemapConfigPage; doc: SitemapConfigPage;}; | if false, disable automatic sitemap generation or specify priority of pages |
siteUrl | string | Deployed site url, also used for auto generated sitemap. |
loaders | 'css-loader'/ | 'postcss-loader' / |
by default,
author
and tags
are category page types
the following example adds a language
category.config/buildtime.js
module.exports = {categories: ['author', 'tags', 'language']pages: {language: {basePath: 'lang/',},},}
the following example sets up custom page types and routes
api
is replacing standarddocs
and adds a new custom tabtest
tutorial
is a new page type
.config/buildtime.js
module.exports = {pages: {story: {basePath: 'api/',tabs: {...defaultBuildConfig.pages.story.tabs,test: '@component-controls/pages/TestingPage',},},tutorial: {basePath: 'tutorial/',},},};
the paths are relative to the config folder where the
buildtime.js
configuration file is located.the following example will search for documents in the
../src/docs
folder.config/buildtime.js
module.exports = {stories: ['../src/docs/*.@(mdx|tsx)'],};
this option allows to install the
component-controls
site under a custom sub-folder on a sitethe following example will prefix all paths with
/docs/
.config/buildtime.js
module.exports = {siteRoot: '/docs/',};
the following example will disable automatic generating the
sitemap.xml
file..config/buildtime.js
module.exports = {siteMap: false,};
the following example creates options to use modules for CSS class names
.config/buildtime.js
module.exports = {loaders: {'css-loader': {modules: {localIdentName: '[name].[local].[hash]',},},},};