Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/huanghui8030/gulp-chsi-rev
gulp插件,静态资源后面添加时间戳作为版本号,达到去缓存的作用。
https://github.com/huanghui8030/gulp-chsi-rev
gulp gulp-chsi-rev gulp-plugin
Last synced: 25 days ago
JSON representation
gulp插件,静态资源后面添加时间戳作为版本号,达到去缓存的作用。
- Host: GitHub
- URL: https://github.com/huanghui8030/gulp-chsi-rev
- Owner: huanghui8030
- License: mit
- Created: 2018-04-27T09:21:25.000Z (almost 7 years ago)
- Default Branch: master
- Last Pushed: 2018-04-28T09:33:30.000Z (almost 7 years ago)
- Last Synced: 2024-11-20T16:52:57.564Z (3 months ago)
- Topics: gulp, gulp-chsi-rev, gulp-plugin
- Language: JavaScript
- Homepage: https://www.npmjs.com/package/gulp-chsi-rev
- Size: 4.88 KB
- Stars: 1
- Watchers: 2
- Forks: 3
- Open Issues: 0
-
Metadata Files:
- Readme: readme.md
- License: LICENSE
Awesome Lists containing this project
README
## gulp-chsi-rev
基于gulp的插件,静态资源后面添加时间戳作为版本号,达到去缓存的作用。
## Installation安装
```bash
npm install gulp-chsi-rev
```## Usage用法
```js
var gulp = require('gulp');
var chsiRev = require('gulp-chsi-rev');gulp.task('rev',function() {
gulp.src("./test/test.html")
.pipe(chsiRev())
.pipe(gulp.dest('./'));
});
```## Example实例
```js
var gulp = require('gulp');
var chsiRev = require('gulp-chsi-rev');gulp.task('rev',['revCss'],function() {
gulp.src("./test/test.html")
.pipe(chsiRev())
.pipe(gulp.dest('./dest'));
});gulp.task('revCss',function () {
return gulp.src('./test/styles/test.css')
.pipe(chsiRev())
.pipe(gulp.dest('./dest/styles/'))
});
gulp.task('default',['rev']);
```### before: test.css
```css
body{background:url('../images/bg.png')}
```### after: test.css
```css
body{background:url("../images/bg.png?v=1482737522923")}
```
### before: test.html
```html
![]()
```
### after: test.html```html
![]()
```
## 更新日志
- v1.1.1 添加注释
- v1.1.0 有个参数写错了
- v1.0.9 删除无用注释
- v1.0.8 每次更改时,所有修改都用同一个时间戳
- v1.0.7 js动态加载进来的js和css,需要增加版本号,例如:
- `if(wapFn()){addFile('css','https://t1.chei.com.cn/yz/sytj/assets/css/wap/tj-wap.min.css');}`
- v1.0.6 t-common目录不修改参数,如果有参数则去掉。例如:
- `" rel="stylesheet"/>`
- ` `
- v1.0.3 链接后面已有参数时,不能再加用“?”,需要改成“&”
- v1.0.2 添加spath访问,可添加版本号
- v1.0.1 删除掉无用的注释
- v1.0.0 初版,添加时间戳版本号