Harold 1.3.0 introduces comprehensive performance optimizations to help your sites achieve excellent Core Web Vitals scores and faster load times.
All CSS output is automatically minified using cssnano, reducing file sizes by 30-50%.
What it does:
Configuration:
{
"minifyCss": true
}
Disable it if needed (not recommended):
{
"minifyCss": false
}
All HTML output is automatically minified, reducing file sizes by 20-40%.
What it does:
Configuration:
{
"minifyHtml": true
}
Disable it if needed (not recommended):
{
"minifyHtml": false
}
Images in markdown posts automatically get optimized for better Core Web Vitals scores.
Automatic Features:
loading="lazy" for better performancedecoding="async"Example:
Input markdown:

Output HTML:
<img src="assets/images/photo.jpg"
alt="My image"
width="800"
height="600"
loading="lazy"
decoding="async" />
Note: Remote images (URLs) won't get automatic dimensions. Specify them manually:
<img src="https://example.com/image.jpg"
alt="Remote image"
width="800"
height="600" />
For advanced image handling, use the responsiveImg Handlebars helper:
Basic usage:
{{responsiveImg
src="assets/images/photo.jpg"
alt="My photo"
}}
With explicit dimensions:
{{responsiveImg
src="assets/images/hero.jpg"
alt="Hero image"
width="1200"
height="600"
}}
Hero image (load immediately):
{{responsiveImg
src="assets/images/hero.jpg"
alt="Hero image"
loading="eager"
className="hero"
}}
Responsive image with multiple sizes:
{{responsiveImg
src="assets/images/gallery.jpg"
alt="Gallery"
srcset="assets/images/gallery-small.jpg 480w, assets/images/gallery-medium.jpg 800w, assets/images/gallery-large.jpg 1200w"
sizes="(max-width: 600px) 480px, (max-width: 1000px) 800px, 1200px"
}}
Parameters:
src (required) - Image source pathalt - Alt text for accessibility (recommended)width - Image width (auto-detected if not provided)height - Image height (auto-detected if not provided)loading - "lazy" (default) or "eager" for above-the-fold imagesdecoding - "async" (default) or "sync"className - CSS class namesrcset - Responsive image sources for different screen sizessizes - Media query sizes for responsive imagesWhen to use eager loading:
When to use lazy loading (default):
Responsive images example:
Create multiple image sizes:
# Original
assets/images/photo.jpg (1200x800)
# Smaller versions
assets/images/photo-small.jpg (480x320)
assets/images/photo-medium.jpg (800x533)
Use with srcset:
{{responsiveImg
src="assets/images/photo.jpg"
alt="Responsive photo"
srcset="assets/images/photo-small.jpg 480w, assets/images/photo-medium.jpg 800w, assets/images/photo.jpg 1200w"
sizes="(max-width: 600px) 100vw, (max-width: 1000px) 80vw, 1200px"
}}
The browser will automatically choose the best image based on screen size and resolution!
The postsList helper now includes optimized images:
{{postsList
perPageLimit=6
noImage=false
}}
All cover images automatically include:
loading="lazy"decoding="async"<!-- Above the fold - load immediately -->
{{responsiveImg
src="assets/images/hero.jpg"
alt="Hero"
loading="eager"
}}
<!-- Below the fold - lazy load -->
{{responsiveImg
src="assets/images/gallery.jpg"
alt="Gallery"
loading="lazy"
}}
Always include width and height for images to prevent layout shift:
<!-- Local images - dimensions detected automatically -->

<!-- Remote images - specify manually -->
<img src="https://example.com/image.jpg"
alt="Remote"
width="800"
height="600" />
Use these tools to check your site's performance:
Complete .haroldrc with performance options:
{
"mdFilesDirName": "posts",
"mdFilesLayoutsDirName": "blog-layouts",
"outputDirName": "build",
"minifyCss": true,
"minifyHtml": true
}
Issue: Some images don't have width/height attributes
Solutions:
Issue: HTML/CSS files are not minified
Solutions:
.haroldrc for minifyHtml and minifyCss settingsnpm install to ensure all dependencies are installedSolutions:
All optimizations are backward compatible and enabled by default. No code changes required!
To update your project:
harold-scripts in your package.jsonnpm installYour site will automatically benefit from: