# grunt-cache-invalidate

> Invalidating cache by appending hash in file name

Latest version **0.1.6** (published 2016-02-22) · 0 weekly downloads

## Install

```sh
npm install grunt-cache-invalidate
pnpm add grunt-cache-invalidate
yarn add grunt-cache-invalidate
bun add grunt-cache-invalidate
```

## Health

**Score 15/100 (F)** — status: abandoned.

Positive: no vulnerabilities.

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

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 0.1.6 |
| Published | 2016-02-22 |
| First published | 2014-06-19 |
| Weekly downloads | 0 |
| TypeScript types | none |
| Module format | CommonJS |
| Node | >= 0.8.0 |
| Dependencies | 0 |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 2 |
| Author | jo32 |
| Maintainers | jo32 |
| Keywords | gruntplugin, cache burst, cache invalidate, cache |

## Links

- npm: https://www.npmjs.com/package/grunt-cache-invalidate
- Repository: https://github.com/jo32/grunt-cache-invalidate
- Issues: https://github.com/jo32/grunt-cache-invalidate/issues
- npm.io page: https://npm.io/package/grunt-cache-invalidate

## Alternatives

- [memory-cache](https://npm.io/package/memory-cache.md) — 795.0K weekly downloads
- [@httptoolkit/proxy-agent](https://npm.io/package/@httptoolkit/proxy-agent.md) — 11.2K weekly downloads
- [express-cache-controller](https://npm.io/package/express-cache-controller.md) — 5.3K weekly downloads
- [http-cache-middleware](https://npm.io/package/http-cache-middleware.md) — 4.5K weekly downloads
- [cache2](https://npm.io/package/cache2.md) — 1.5K weekly downloads

## Recent versions

- 0.1.6 (latest) — 2016-02-22
- 0.1.5 — 2016-01-14
- 0.1.4 — 2014-06-20
- 0.1.3 — 2014-06-20
- 0.1.2 — 2014-06-20
- 0.1.1 — 2014-06-20
- 0.1.0 — 2014-06-19

## README

# grunt-cache-invalidate

> Invalidating cache by appending hash in file name

## Getting Started
This plugin requires Grunt `~0.4.5`

If you haven't used [Grunt](http://gruntjs.com/) before, be sure to check out the [Getting Started](http://gruntjs.com/getting-started) guide, as it explains how to create a [Gruntfile](http://gruntjs.com/sample-gruntfile) as well as install and use Grunt plugins. Once you're familiar with that process, you may install this plugin with this command:

```shell
npm install grunt-cache-invalidate --save-dev
```

Once the plugin has been installed, it may be enabled inside your Gruntfile with this line of JavaScript:

```js
grunt.loadNpmTasks('grunt-cache-invalidate');
```

## The "cache_invalidate" task

### Overview
In your project's Gruntfile, add a section named `cache_invalidate` to the data object passed into `grunt.initConfig()`.

```js
grunt.initConfig({
  cache_invalidate: {
    your_target: {
      src: ['sample.html', ...],
      dest: 'build'
    }
  },
});
```

### Features

Now it will recursively resolve your referrences between files and will break the circuler reference.

### Options

move - true deletes the resource src files

### Usage Examples

#### Configuration

```js
grunt.initConfig({
  cache_invalidate: {
    your_target: {
      src: ['sample.html', ...],
      dest: 'build',
      move: false
    }
  },
});
```

#### "sample.html" before running this task

```html
<!DOCTYPE html>
<html>
<head>
    <title>Hello World!</title>
    <script type="text/javascript" src="sample1.js#grunt-cache-invalidate"></script>
    <script type="text/javascript" src="sample2.js#grunt-cache-invalidate"></script>
</head>
<body>

</body>
</html>
```

#### "sample.html" after running this task

```html
<!DOCTYPE html>
<html>
<head>
    <title>Hello World!</title>
    <script type="text/javascript" src="sample1.5340dc1df.js"></script>
    <script type="text/javascript" src="sample2.e7d97adc3.js"></script>
</head>
<body>

</body>
</html>
```

And `sample1.5340dc1df.js`, `sample2.e7d97adc3.js` should be in your dest folder.

## Release History

2014.06.19 - v0.01.0

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