npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

gulp-chsi-rev

v1.2.2

Published

基于gulp的插件,静态资源后面添加时间戳作为版本号,达到去缓存的作用。

Downloads

12

Readme

gulp-chsi-rev

基于gulp的插件,静态资源后面添加时间戳作为版本号,达到去缓存的作用。

Installation安装

npm install gulp-chsi-rev

Usage用法

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实例

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

body{background:url('../images/bg.png')}

after: test.css

body{background:url("../images/bg.png?v=1482737522923")}

before: test.html

<html lang="en">
<head>
    <meta charset="utf-8"/>
    <title></title>
    <link rel="stylesheet" href="./styles/test.css" type="text/css" />
</head>
<body>
    <div>
        <img src="./images/test.png" />
    </div>
    <script src="./scripts/test.js" type="text/javascript"></script>
</body>
</html>

after: test.html

<html lang="en">
<head>
    <meta charset="utf-8"/>
    <title></title>
    <link rel="stylesheet" href="./styles/test.css?v=1482737522924" type="text/css" />
</head>
<body>
    <div>
        <img src="./images/test.png?v=148273752295" />
    </div>
    <script src="./scripts/test.js?v=1482737522926" type="text/javascript"></script>
</body>
</html>

更新日志

  • v.1.2.2 修复bug Buffer.from 代替 new Buffer

  • v.1.2.1 使用安全的 Buffer.alloc 代替 new Buffer

  • v.1.2.0 主要用来处理生成的css文件,原jsp改为动态生成,排除了一些CDN选项;精简了代码,修正了正则判断,修复了在css中input[type="button"]::-moz-focus-inner 错加版本号的问题。

  • v1.1.1 添加注释

  • v1.1.0 有个参数写错了

  • v1.0.9 删除无用注释

  • v1.0.8 每次更改时,所有修改都用同一个时间戳

  • v1.0.7 js动态加载进来的js和css,需要增加版本号,例如:

    • <script>if(wapFn()){addFile('css','https://t1.chei.com.cn/yz/sytj/assets/css/wap/tj-wap.min.css');}</script>
  • v1.0.6 t-common目录不修改参数,如果有参数则去掉。例如:

    • <link href="<chsi:spath path="/ch/iconfont.css" commonResource='true' />" rel="stylesheet"/>
    • <script src="http://t3.chei.com.cn/common/js/jquery/jquery-1.8.3.min.js"></script>
  • v1.0.3 链接后面已有参数时,不能再加用“?”,需要改成“&”

  • v1.0.2 添加spath访问,可添加版本号

  • v1.0.1 删除掉无用的注释

  • v1.0.0 初版,添加时间戳版本号