forked from mapbox/mapbox-gl-js
-
Notifications
You must be signed in to change notification settings - Fork 0
/
batfish.config.js
54 lines (51 loc) · 2.04 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
const { webpack } = require('@mapbox/batfish');
const path = require('path');
module.exports = () => {
const config = {
siteBasePath: '/mapbox-gl-js',
siteOrigin: 'https://www.mapbox.com',
pagesDirectory: `${__dirname}/docs/pages`,
outputDirectory: path.join(__dirname, '_site'),
stylesheets: [
`${__dirname}/docs/components/site.css`,
`${__dirname}/docs/components/prism_highlight.css`,
`${__dirname}/vendor/dotcom-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/dotcom-page-shell/page-shell-script.js`
}
],
dataSelectors: {
examples: ({pages}) => {
return pages
.filter(({path, frontMatter}) => /\/example\//.test(path) && frontMatter.tags)
.map(({frontMatter}) => frontMatter);
}
},
devBrowserslist: false
};
// 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;
};