A new script for HTML minification has been added, which is run after the build process. Several dependencies were updated, including the Astro framework and its related plugins. The 'astro-critters' package and its usage in the Astro configuration were removed. A minor animation timing change was also made in the [...slug].astro file.
22 lines
No EOL
580 B
JavaScript
22 lines
No EOL
580 B
JavaScript
import fs from 'node:fs/promises'
|
|
import { globby } from 'globby'
|
|
import { minify } from 'html-minifier'
|
|
|
|
// Get all HTML files from the output directory
|
|
const path = './.vercel/output/static'
|
|
const files = await globby(`${path}/**/*.html`)
|
|
|
|
await Promise.all(
|
|
files.map(async (file) => {
|
|
console.log('Processing file:', file)
|
|
let html = await fs.readFile(file, 'utf-8')
|
|
|
|
// Minify the HTML
|
|
html = minify(html, {
|
|
removeComments: true,
|
|
preserveLineBreaks: true,
|
|
collapseWhitespace: true
|
|
})
|
|
await fs.writeFile(file, html)
|
|
})
|
|
) |