github-pages-template
github-pages-template copied to clipboard
Add dirty file extensions checker
This is a script that runs on the built site.
It simple looks at all the file names.
The script has a hard coded list of unacceptable file extensionns. And matches are reported as an error and displayes advice for that file extension.
Use case insensitive lookup of file extensions.
Example output
❌ articles/horses.png Google recommends to move from PNG to WebP https://web.dev/articles/choose-the-right-image-format
✅ Site includes file extensions: html svg webp
Following are dirty file extensions:
- .png Only use WebP for bitmap images https://web.dev/articles/choose-the-right-image-format
- .jpg Only use WebP for bitmap images https://web.dev/articles/choose-the-right-image-format
- .jpeg Only use WebP for bitmap images WebP https://web.dev/articles/choose-the-right-image-format
- .gif Only use WebP for bitmap images https://web.dev/articles/choose-the-right-image-format
- .ico (CHECK BROWSER SUPPORT FOR favicon.webp)
- .woff Only use WOFF2 for fonts https://web.dev/learn/performance/optimize-web-fonts
- .eot Only use WOFF2 for fonts https://web.dev/learn/performance/optimize-web-fonts
- .ttf Only use WOFF2 for fonts https://web.dev/learn/performance/optimize-web-fonts
- .htm Prefer to use .html file extension
- .ogv Only use .webm for video files
- .mp4 Only use .webm for video files
- .mp3 Only use .webm for video files