Further improvements to page prerendering
This commit is contained in:
parent
44a9cad9b3
commit
94e511bb96
3
src/pages/404/config.js
Normal file
3
src/pages/404/config.js
Normal file
@ -0,0 +1,3 @@
|
|||||||
|
module.exports = {
|
||||||
|
title: 'Regexper - Page Not Found'
|
||||||
|
};
|
3
src/pages/index/config.js
Normal file
3
src/pages/index/config.js
Normal file
@ -0,0 +1,3 @@
|
|||||||
|
module.exports = {
|
||||||
|
title: 'Regexper'
|
||||||
|
};
|
@ -3,13 +3,13 @@
|
|||||||
<head>
|
<head>
|
||||||
<meta charSet="utf-8" />
|
<meta charSet="utf-8" />
|
||||||
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no" />
|
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no" />
|
||||||
<meta name="description" content={ pkg.description } />
|
<meta name="description" content="<%= htmlWebpackPlugin.options.description %>" />
|
||||||
|
|
||||||
<link rel="author" href="/humans.txt" />
|
<link rel="author" href="/humans.txt" />
|
||||||
|
|
||||||
<title>Regexper</title>
|
<title><%= htmlWebpackPlugin.options.title %></title>
|
||||||
</head>
|
</head>
|
||||||
<body data-build-id="<%= process.env.BUILD_ID %>">
|
<body data-build-id="<%= htmlWebpackPlugin.options.buildId %>">
|
||||||
<div id="root"></div>
|
<div id="root"></div>
|
||||||
</body>
|
</body>
|
||||||
</html>
|
</html>
|
||||||
|
@ -7,9 +7,16 @@ const FaviconsPlugin = require('favicons-webpack-plugin-cesco');
|
|||||||
const HtmlPlugin = require('html-webpack-plugin');
|
const HtmlPlugin = require('html-webpack-plugin');
|
||||||
|
|
||||||
const pkg = require('./package.json');
|
const pkg = require('./package.json');
|
||||||
|
const buildId = [
|
||||||
|
process.env.CIRCLE_BRANCH || 'prerelease',
|
||||||
|
process.env.CIRCLE_BUILD_NUM || '##',
|
||||||
|
(process.env.CIRCLE_SHA1 || 'gitsha').slice(0, 7)
|
||||||
|
].join('-');
|
||||||
|
|
||||||
const pages = fs.readdirSync(path.resolve(__dirname, 'src/pages'));
|
const pages = fs.readdirSync(path.resolve(__dirname, 'src/pages'));
|
||||||
const pagePlugins = pages.map(name => new HtmlPlugin({
|
const pagePlugins = pages.map(name => new HtmlPlugin({
|
||||||
|
description: pkg.description,
|
||||||
|
buildId,
|
||||||
template: './src/template.html',
|
template: './src/template.html',
|
||||||
filename: `${ name }.html`,
|
filename: `${ name }.html`,
|
||||||
chunks: ['common', name],
|
chunks: ['common', name],
|
||||||
@ -23,7 +30,8 @@ const pagePlugins = pages.map(name => new HtmlPlugin({
|
|||||||
minifyJS: true,
|
minifyJS: true,
|
||||||
minifyCSS: true,
|
minifyCSS: true,
|
||||||
minifyURLs: true
|
minifyURLs: true
|
||||||
}
|
},
|
||||||
|
...require(`./src/pages/${ name }/config`)
|
||||||
}));
|
}));
|
||||||
|
|
||||||
module.exports = {
|
module.exports = {
|
||||||
@ -42,11 +50,7 @@ module.exports = {
|
|||||||
GA_PROPERTY: null,
|
GA_PROPERTY: null,
|
||||||
SENTRY_KEY: null,
|
SENTRY_KEY: null,
|
||||||
BANNER: process.env.NODE_ENV === 'production' ? null : (process.env.NODE_ENV || 'development'),
|
BANNER: process.env.NODE_ENV === 'production' ? null : (process.env.NODE_ENV || 'development'),
|
||||||
BUILD_ID: [
|
BUILD_ID: buildId
|
||||||
process.env.CIRCLE_BRANCH || 'prerelease',
|
|
||||||
process.env.CIRCLE_BUILD_NUM || '##',
|
|
||||||
(process.env.CIRCLE_SHA1 || 'gitsha').slice(0, 7)
|
|
||||||
].join('-')
|
|
||||||
}),
|
}),
|
||||||
new webpack.optimize.CommonsChunkPlugin({
|
new webpack.optimize.CommonsChunkPlugin({
|
||||||
name: 'common',
|
name: 'common',
|
||||||
|
Loading…
Reference in New Issue
Block a user