Remove preload for theme css files (#17468)

Signed-off-by: AllForNothing <sshijun@vmware.com>

Signed-off-by: AllForNothing <sshijun@vmware.com>
This commit is contained in:
Shijun Sun 2022-08-29 11:32:41 +08:00 committed by GitHub
parent 306e780590
commit 1ce5d98efe
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 0 additions and 23 deletions

View File

@ -16,24 +16,3 @@ if (buildTimestampIndex > 0) {
data[buildTimestampIndex] = ` buildTimestamp: ${timestamp},`;
fs.writeFileSync('src/environments/environment.prod.ts', data.join('\n'), 'utf8');
}
// modify below lines in src/index.html to add buildTimestamp query string, in case of css cache in different builds
// <link rel="preload" as="style" href="./light-theme.css">
// <link rel="preload" as="style" href="./dark-theme.css">
const indexHtmlData = fs.readFileSync('src/index.html', 'utf8').split('\n');
let lightIndex = 0;
let darkIndex =0;
indexHtmlData.forEach((item,index) => {
if(item.indexOf('light-theme.css') !== -1) {
lightIndex = index;
}
if(item.indexOf('dark-theme.css') !== -1) {
darkIndex = index;
}
});
if (lightIndex > 0 && darkIndex > 0) {
indexHtmlData[lightIndex] = ` <link rel="preload" as="style" href="./light-theme.css?buildTimestamp=${timestamp}">`;
indexHtmlData[darkIndex] = ` <link rel="preload" as="style" href="./dark-theme.css?buildTimestamp=${timestamp}">`;
fs.writeFileSync('src/index.html', indexHtmlData.join('\n'), 'utf8');
}

View File

@ -6,8 +6,6 @@
<base href="/" />
<meta name="viewport" content="width=device-width, initial-scale=1" />
<link rel="icon" type="image/x-icon" href="favicon.ico?v=2" />
<link rel="preload" as="style" href="./light-theme.css" />
<link rel="preload" as="style" href="./dark-theme.css" />
</head>
<body>
<harbor-app>