# gulp-rev-stamp

> 以最简单粗暴的方式，添加静态资源版本号，防止浏览器缓存

Latest version **0.0.3** (published 2018-01-04) · MIT license · 0 weekly downloads

## Install

```sh
npm install gulp-rev-stamp
pnpm add gulp-rev-stamp
yarn add gulp-rev-stamp
bun add gulp-rev-stamp
```

## 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.0.3 |
| Published | 2018-01-04 |
| First published | 2018-01-04 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Node | >=4 |
| Dependencies | 2 |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 0 |
| Author | khadron |
| Maintainers | khadron |
| Keywords | gulp, rev, stamp, timestamp, 时间戳, 版本号 |

## Links

- npm: https://www.npmjs.com/package/gulp-rev-stamp
- Repository: https://github.com/khadron/gulp-rev-stamp
- Homepage: https://github.com/khadron/gulp-rev-stamp#readme
- Issues: https://github.com/khadron/gulp-rev-stamp/issues
- npm.io page: https://npm.io/package/gulp-rev-stamp

## Dependencies (2)

- [gulp-util](https://npm.io/package/gulp-util.md) ^2.2.20
- [event-stream](https://npm.io/package/event-stream.md) ^3.3.4

## Recent versions

- 0.0.3 (latest) — 2018-01-04
- 0.0.2 — 2018-01-04
- 1.0.1 — 2018-01-04
- 1.0.0 — 2018-01-04

## README

# gulp-rev-stamp
以最简单粗暴的方式，添加静态资源版本号，防止浏览器缓存

## 安装

```shell

$ npm install --save-dev gulp-rev-stamp

```

## 使用

```javascript
// gulpfile.js
const gulp = require('gulp');
const stamp = require('gulp-rev-stamp');

gulp.task("build", function() {
    gulp.src('./test/index.html')
    .pipe(stamp('$hehe$'))
    .pipe(gulp.dest('./test/dist'));
});

```
```html
<!--index.html-->
<!DOCTYPE html>
<html>
<head>
    <title>测试时间戳</title>
    <link rel="stylesheet" type="text/css" href="./main.css?v=$hehe$" />
</head>
<body>
<h1 >就是这么简单粗暴！</h1>
</body>
<script>
	var a = 'v=$hehe$'
</script>
</html>

```

## API
只有一个stamp函数，它只有一个参数，就是要替换版本号的占位符。比如上面的示例，\$hehe\$就是占位符。
就是这么简单粗暴，所以在使用的过程中，占位符的选择尽量避免一些常用的字符，以免误伤(*￣︶￣)

## License

MIT © [khadron](https://www.cnblogs.com/Khadron/)

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