# gulp-filename-hash

> append md5 string to filename or path as a query parameter

Latest version **0.2.1** (published 2016-05-04) · MIT license · 0 weekly downloads

## Install

```sh
npm install gulp-filename-hash
pnpm add gulp-filename-hash
yarn add gulp-filename-hash
bun add gulp-filename-hash
```

## 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.2.1 |
| Published | 2016-05-04 |
| First published | 2016-04-14 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 0 |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Author | flfwzgl |
| Maintainers | flfwzgl |
| Keywords | gulp, md5, filename |

## Links

- npm: https://www.npmjs.com/package/gulp-filename-hash
- Repository: https://github.com/flfwzgl/gulp-filename-hash
- Homepage: https://github.com/flfwzgl/gulp-filename-hash#readme
- Issues: https://github.com/flfwzgl/gulp-filename-hash/issues
- npm.io page: https://npm.io/package/gulp-filename-hash

## Alternatives

- [@mdxeditor/editor](https://npm.io/package/@mdxeditor/editor.md) — 962.4K weekly downloads
- [mmdb-lib](https://npm.io/package/mmdb-lib.md) — 680.9K weekly downloads
- [playcanvas](https://npm.io/package/playcanvas.md) — 36.2K weekly downloads
- [@glw907/cairn-cms](https://npm.io/package/@glw907/cairn-cms.md) — 967 weekly downloads
- [markdown-to-confluence](https://npm.io/package/markdown-to-confluence.md) — 103 weekly downloads

## Recent versions

- 0.2.1 (latest) — 2016-05-04
- 0.2.0 — 2016-04-16
- 0.0.1 — 2016-04-15
- 0.1.0 — 2016-04-14

## README

Replace filenames with a md5 string, or append filenames with a md5 string as query parameter.

### For example:
```
var dest = '../dist';
var hash = require('gulp-add-hash');

gulp.task('html', ['less', 'js'], function(){
  gulp.src(['**/*.src.jade'])
      .pipe(data(function() {
        return require('./data');
      }))
      .pipe(jade({pretty: false}))
      .pipe(hash({  
        query: true,
        base: dest
      }))
      .pipe(gulp.dest(dest))
});
```

### Options:
* query -- default: ```false```
  * ```false```,  ```<link href="index.css">``` ===> ```<link href="index_fdafda6789.css">```, the filename of index.css will be changed.
  * ```true```,   ```<link href="index.css">``` ===> ```<link href="index.css?v=fdafda6789">```

* base -- base dir, default: ```./```

* length -- the length of md5 string, default: ```10```

* ext -- allowed extensions, type: ```Array```, default: ```['.css', '.js', '.jpg', '.png', '.gif']```


### Note:
* Before using the ```gulp-filename-hash```, You must make sure that all the static files have been generated.(See [Synchronous tasks with Gulp](http://schickling.me/synchronous-tasks-gulp/)), otherwize the ```gulp-filename-hash``` will skip.
* This gulp plugin only checks the link in ```href```, ```src``` and ```url()```, and then appends a md5 string to them.

---

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