Compare commits
3 Commits
80a4717b14
...
4ad45d5625
| Author | SHA1 | Date | |
|---|---|---|---|
|
4ad45d5625
|
|||
|
e6f2e92083
|
|||
|
4503298213
|
@@ -29,13 +29,35 @@ async function main() {
|
|||||||
logLevel: 'warn',
|
logLevel: 'warn',
|
||||||
});
|
});
|
||||||
|
|
||||||
const files = fs.readdirSync(DIST).filter((f) => f.endsWith('.html'));
|
const rootFiles = fs.readdirSync(DIST)
|
||||||
for (const file of files) {
|
.filter((f) => f.endsWith('.html'))
|
||||||
const filePath = path.join(DIST, file);
|
.map((f) => path.join(DIST, f));
|
||||||
|
|
||||||
|
const servicesDir = path.join(DIST, 'services');
|
||||||
|
const serviceFiles = [];
|
||||||
|
|
||||||
|
if (fs.existsSync(servicesDir)) {
|
||||||
|
const walk = (dir) => {
|
||||||
|
for (const entry of fs.readdirSync(dir, { withFileTypes: true })) {
|
||||||
|
const fullPath = path.join(dir, entry.name);
|
||||||
|
if (entry.isDirectory()) {
|
||||||
|
walk(fullPath);
|
||||||
|
} else if (entry.isFile() && entry.name.endsWith('.html')) {
|
||||||
|
serviceFiles.push(fullPath);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
walk(servicesDir);
|
||||||
|
}
|
||||||
|
|
||||||
|
const files = [...rootFiles, ...serviceFiles];
|
||||||
|
|
||||||
|
for (const filePath of files) {
|
||||||
let html = fs.readFileSync(filePath, 'utf8');
|
let html = fs.readFileSync(filePath, 'utf8');
|
||||||
html = await beasties.process(html);
|
html = await beasties.process(html);
|
||||||
fs.writeFileSync(filePath, html, 'utf8');
|
fs.writeFileSync(filePath, html, 'utf8');
|
||||||
console.log('✓ Critical CSS inlined → dist/' + file);
|
console.log('✓ Critical CSS inlined → dist/' + path.relative(DIST, filePath));
|
||||||
}
|
}
|
||||||
|
|
||||||
console.log('Critical CSS step complete.');
|
console.log('Critical CSS step complete.');
|
||||||
|
|||||||
@@ -38,6 +38,8 @@
|
|||||||
data-website-id="72ac01ce-e7fc-4582-8593-703f15add8d5"
|
data-website-id="72ac01ce-e7fc-4582-8593-703f15add8d5"
|
||||||
></script>
|
></script>
|
||||||
<script defer src="/assets/js/umami-helper.js"></script>
|
<script defer src="/assets/js/umami-helper.js"></script>
|
||||||
|
<!-- Microsoft Clarity -->
|
||||||
|
<script defer src="https://www.clarity.ms/tag/vuo5q3yf79?ref=bwt"></script>
|
||||||
|
|
||||||
<title>{merged.title}</title>
|
<title>{merged.title}</title>
|
||||||
<meta name="description" content={merged.description ?? ''} />
|
<meta name="description" content={merged.description ?? ''} />
|
||||||
|
|||||||
Reference in New Issue
Block a user