An Eleventy plugin that automatically adds content-hash based cache-busting query parameters (?v=...) to asset URLs (CSS, JS, images, etc.) with zero configuration. Currently at version 0.9.2, it requires Node >=20 and works with Eleventy. Unlike traditional cache-busting filters, it operates as a transform, meaning no template code changes are needed. It supports configurable hash algorithms, file extension filtering, glob patterns, and asynchronous processing. The plugin is lightweight and ideal for static sites built with Eleventy that need long-term caching without manual versioning.
npm install eleventy-auto-cache-busterNo compatibility data collected yet for this library.
Verified import paths — ran on the pinned version, not inferred.
Sets up the plugin with custom options including hash truncation, async processing, glob patterns, file extensions, and SHA-256 hashing. No template modifications needed.
Use dynamic import: const eleventyAutoCacheBuster = (await import('eleventy-auto-cache-buster')).default; or switch to ESM config.Pin to exact version in package.json to avoid unexpected changes.
Always pass a number: hashTruncate: 8
Set globstring to a more specific pattern (e.g., '_site/**/*') or add ignore: ['node_modules/**'] to globOptions.
Verify that globstring covers your output directory (default is Eleventy's output dir).
Use dynamic import: const eleventyAutoCacheBuster = (await import('eleventy-auto-cache-buster')).default;Ensure the globstring matches files in Eleventy's output (default: '_site'). Set globstring to '_site/**/*' or a similar path.
Check that the globstring includes your output directory (e.g., '_site/**/*.html') and that asset tags use relative paths.
Upgrade to Node >=20 and ensure your .eleventy.js is treated as ESM or use dynamic import.