fix(docs-infra): generate the `404.html` page correctly (#41163)
Previously, the generated `404.html` page did not include a `<body>` tag. In some browsers (such as IE 11), this was causing warnings in the console. This commit ensures the generated page contains a `<body>` tag. It also fixes the indentation in the generated page. PR Close #41163
This commit is contained in:
parent
79e21b966e
commit
e1e766a880
|
@ -18,8 +18,9 @@ function _main() {
|
|||
const dst404PagePath = join(DIST_DIR, '404.html');
|
||||
|
||||
const srcIndexContent = readFileSync(srcIndexPath, 'utf8');
|
||||
const src404BodyContent = readFileSync(src404BodyPath, 'utf8');
|
||||
const dst404PageContent = srcIndexContent.replace(/<body>[\s\S]+<\/body>/, src404BodyContent);
|
||||
const src404BodyContent = readFileSync(src404BodyPath, 'utf8').trim();
|
||||
const dst404PageContent = srcIndexContent
|
||||
.replace(/(<body>)[\s\S]+(<\/body>)/, `$1\n ${src404BodyContent}\n$2`);
|
||||
|
||||
if (dst404PageContent === srcIndexContent) {
|
||||
throw new Error(
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
<!--
|
||||
This content replaces the `<body>` content of `index.html` to generate our custom `404.html` page.
|
||||
The content must visually and structurally resemble the resulting HTML of the main app for not
|
||||
found pages (e.g. https://angular.io/not/existing).
|
||||
found pages (e.g. https://angular.io/not/exist.ing).
|
||||
-->
|
||||
|
||||
<style>
|
||||
|
|
Loading…
Reference in New Issue