# eleventy-auto-cache-buster

> Busts cache using ?v= with minimal configuration!

Latest version **0.9.2** (published 2026-03-14) · MIT license · 0 weekly downloads

## Install

```sh
npm install eleventy-auto-cache-buster
pnpm add eleventy-auto-cache-buster
yarn add eleventy-auto-cache-buster
bun add eleventy-auto-cache-buster
```

## Health

**Score 50/100 (C)** — status: stable.

Positive: no vulnerabilities; has provenance.

Warnings: low downloads; no types; no esm support; pre 1.0.

## Facts

| | |
|---|---|
| Version | 0.9.2 |
| Published | 2026-03-14 |
| First published | 2023-12-04 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Node | >=20 |
| Dependencies | 2 |
| Unpacked size | 12.1 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Provenance | attested (GitHub Actions) |
| Author | Denperidge |
| Maintainers | denperidge |

## Links

- npm: https://www.npmjs.com/package/eleventy-auto-cache-buster
- Repository: https://github.com/Denperidge/eleventy-auto-cache-buster
- Homepage: https://github.com/Denperidge/eleventy-auto-cache-buster#readme
- Issues: https://github.com/Denperidge/eleventy-auto-cache-buster/issues
- npm.io page: https://npm.io/package/eleventy-auto-cache-buster

## Dependencies (2)

- [glob](https://npm.io/package/glob.md) ^13.0.6
- [escape-string-regexp](https://npm.io/package/escape-string-regexp.md) ^5.0.0

## Recent versions

- 0.9.2 (latest) — 2026-03-14
- 0.9.1 — 2026-03-09
- 0.9.0 — 2026-03-07
- 0.8.4 — 2026-03-01
- 0.8.3 — 2025-11-17
- 0.8.2 — 2025-11-02
- 0.8.1 — 2025-02-27
- 0.8.0 — 2025-02-24
- 0.7.0 — 2024-12-02
- 0.6.1 — 2024-09-16
- 0.6.0 — 2024-08-13
- 0.5.0 — 2024-07-27
- 0.4.2 — 2024-07-15
- 0.4.1 — 2024-07-15
- 0.4.0 — 2024-07-13
- … 4 more at https://npm.io/package/eleventy-auto-cache-buster/versions

## README

# Eleventy-Auto-Cache-Buster
An Eleventy content-hash based cache buster, not requiring any filters or code changes aside from adding the plugin in `.eleventy.js`!

Turn...
```html
<link rel="icon" type="image/x-icon" href="/favicon.ico">
<link rel="stylesheet" href="/stylesheet.css">
```
Into...
```html
<link rel="icon" type="image/x-icon" href="/favicon.ico?v=542610a0404a5b8a2f5459c0fc5b9691">
<link rel="stylesheet" href="/stylesheet.css?v=c9ca3e51cf7edc4c86c5fef68361957c">
```

## How-to
### Getting started
1. Install the plugin
    - pnpm: `pnpm install eleventy-auto-cache-buster`
    - Yarn: `yarn add -D eleventy-auto-cache-buster`
    - npm: `npm install --save-dev eleventy-auto-cache-buster`
2. Enable the plugin
    ```js
    // .eleventy.js
    
    const eleventyAutoCacheBuster = require("eleventy-auto-cache-buster");
    
    // Alternatively, you can use ESM
    import eleventyAutoCacheBuster from "eleventy-auto-cache-buster";

    module.exports = function (eleventyConfig) {
        eleventyConfig.addPlugin(eleventyAutoCacheBuster);
        // ...
    }
    ```
    
3. That's it! No further changes are required.

### Changing options
```js
// .eleventy.js
const eleventyAutoCacheBuster = require("eleventy-auto-cache-buster");

module.exports = function (eleventyConfig) {
    eleventyConfig.addPlugin(eleventyAutoCacheBuster, {
        enableLogging: true,  // Whether to enable eleventy-auto-cache-buster logging.
        hashTruncate: 0,  // Desired substring length of the hash. Set to 0 or lower to disable truncating
        runAsync: false,  // Whether to run asynchronously. Default is true
        globstring: "subdir/**/*",  // What glob string is used to locate assets.
        globOptions: {nodir: true, ignore: ['node_modules/**', 'tmp/**']} // exclude multiple files or directories. (NOTE: `nodir` will automatically be set to true).  Reference: https://github.com/isaacs/node-glob#readme
        extensions: ["css"],  // What file extensions are accepted when locating assets.
        hashAlgorithm: "sha1",  // What hash method to pass to the hash function. See Node.js' crypto.createHash documentation.
        hashFunction: function (content) { return "example" }  // What function to run to calculate hashes. Overrides hashAlgorithm.
    });
    // ...
}
```

### Clone locally/dev
This requires git & Node.js to be installed
```bash
# Clone repository & enter directory
git clone https://github.com/Denperidge/eleventy-auto-cache-buster.git
cd eleventy-auto-cache-buster

# Prepare correct pnpm version
corepack enable
# Install dependencies
pnpm install
# Run tests
pnpm test
```

## License
This project is licensed under the [MIT License](LICENSE).

---
_Source: https://npm.io/package/eleventy-auto-cache-buster · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
