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-rev-append-fake

v1.1.2

Published

copy "gulp-rev-append"

Downloads

7

Readme

描述

  • 名称:gulp-rev-append-fake
  • 功能:避免浏览器缓存,自动在静态资源路径后面增加动态hash或时间戳。

用法

 #安装 
npm i -D gulp-rev-append-fake gulp
//gulpfile.js 
var gulp = require('gulp');
var revFake = require('gulp-rev-append-fake');

gulp.task("rev",()=>{
    return gulp.src('src/index.html')
    .pipe(rev())
    .pipe(gulp.dest('dist/index.html'))
})
<!-- index.html -->

<link href="dist/index.css?rev=@@hash" rel="stylesheet"/>
<!-- <link href="dist/index.css?rev=5cadf43edba6a97980d42331f9fffd17" rel="stylesheet"/> -->


<script src="dist/index..js?rev=@@hash"></script>
<!-- <script src="dist/index..js?rev=5cadf43edba6a97980d42331f9fffd17"></script> -->


<img src="./dist/index.png?rev=@@hash" />
<!-- <img src="./dist/index.png?rev=5cadf43edba6a97980d42331f9fffd17" /> -->


<a href="./dsit/index.html?rev=@@hash" >index</a>
<!-- <a href="./dsit/index.html?rev=5cadf43edba6a97980d42331f9fffd17" >index</a> -->

参数(options)

  • mode (defalut : strict) -- 分为 严格模式,简单模式和松散模式

    • strict:严格模式
      1. 针对文件内容分型产生hash值,所以文件内容没有改变不产生新的hash值。
      2. 如果找不到文件则不添加替换@@hash
    • easy: 简单模式
      1. 不需要关心页面引用资源是否在本地存在。不管文件是否存在都直接替换。
      2. 以当前毫秒时间戳替换@@hash
  • loose:松散模式

    1. 对找得到的文件使用strict模式增加 动态hash;对找不到的文件使用easy模式增加动态时间戳
  • outputPath:(defalut : '') -- 配置html的输出目录,用来对相对路径的文件引用进行查找。

  • rootDir:(default : 当前项目的根目录) -- 配置网站站点的根目录 , 用来对绝对路径文件进行查找