forked from mapbox/mapbox-gl-js
-
Notifications
You must be signed in to change notification settings - Fork 0
/
batfish.config.js
85 lines (82 loc) · 3.39 KB
/
batfish.config.js
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
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
const webpack = require('webpack');
const mapboxAssembly = require('@mapbox/mbx-assembly');
const path = require('path');
module.exports = () => {
const config = {
siteBasePath: '/mapbox-gl-js',
siteOrigin: 'https://docs.mapbox.com',
pagesDirectory: `${__dirname}/docs/pages`,
outputDirectory: path.join(__dirname, '_site'),
browserslist: mapboxAssembly.browsersList,
postcssPlugins: mapboxAssembly.postcssPipeline.plugins,
stylesheets: [
require.resolve('@mapbox/mbx-assembly/dist/assembly.css'),
require.resolve('@mapbox/dr-ui/css/docs-prose.css'),
`${__dirname}/docs/components/site.css`,
require.resolve('@mapbox/dr-ui/css/prism.css'),
`${__dirname}/vendor/docs-page-shell/page-shell-styles.css`
],
applicationWrapperPath: `${__dirname}/docs/components/application-wrapper.js`,
webpackLoaders: [
// Use raw loader to get the HTML string contents of examples
{
test: /\.html$/,
use: 'raw-loader'
}
],
ignoreWithinPagesDirectory: ['example/*.html'],
webpackPlugins: [
// Make environment variables available within JS that Webpack compiles.
new webpack.DefinePlugin({
// DEPLOY_ENV is used in config to pick between local/production.
'process.env.DEPLOY_ENV': `"${process.env.DEPLOY_ENV}"`
})
],
inlineJs: [
{
filename: `${__dirname}/vendor/docs-page-shell/page-shell-script.js`
}
],
jsxtremeMarkdownOptions: {
wrapper: path.join(__dirname, './docs/components/markdown-page-shell.js'),
rehypePlugins: [
require('@mapbox/dr-ui/plugins/add-links-to-headings'),
require('@mapbox/dr-ui/plugins/make-table-scroll')
]
},
dataSelectors: {
examples: ({pages}) => {
return pages
.filter(({path, frontMatter}) => /\/example\//.test(path) && frontMatter.tags)
.map(example => {
return {
path: example.path,
title: example.frontMatter.title,
description: example.frontMatter.description,
tags: example.frontMatter.tags,
pathname: example.frontMatter.pathname
};
});
},
listSubfolders: data => {
const folders = data.pages
.filter(file => {
return file.path.split('/').length === 4;
})
.map(folder => {
return folder;
});
return folders;
}
},
devBrowserslist: false,
babelInclude: ['documentation']
};
// Local builds treat the `dist` directory as static assets, allowing you to test examples against the
// local branch build. Non-local builds ignore the `dist` directory, and examples load assets from the CDN.
config.unprocessedPageFiles = ['**/dist/**/*.*'];
if (process.env.DEPLOY_ENV !== 'local') {
config.ignoreWithinPagesDirectory.push('**/dist/**/*.*');
}
return config;
};