Socket
Socket
Sign inDemoInstall

gulp-html-version

Package Overview
Dependencies
56
Maintainers
1
Versions
6
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    gulp-html-version

Gulp plugin to append version from package.json


Version published
Weekly downloads
11
increased by450%
Maintainers
1
Install size
809 kB
Created
Weekly downloads
 

Readme

Source

gulp-html-version

gulp 插件,避免版本差异缓存,自动添加 css、js 版本号

安装

npm install gulp-html-version --save-dev

使用

gulpfile.js:

var gulp = require('gulp');
gulpHtmlVersion = require('gulp-html-version');

gulp.task('default', function() {
    return gulp.src('./*.html')
        .pipe(gulpHtmlVersion())
        .pipe(gulp.dest('./build/'));
});

html:

<link rel="stylesheet" href="./example.css">
<script src="./example.js"></script>
<script src="./example1.js?code=utf-8"></script>

结果:

<link rel="stylesheet" href="./example.css?v=0.3.2">
<script src="./example.js?v=0.3.2"></script>
<script src="./example1.js?code=utf-8&v=0.3.2"></script>

参数

.pipe(gulpHtmlVersion({
    paramName: 'version',
    paramType: 'timestamp',
    suffix: ['css', 'js', 'jpg']
}))

参数列表

  • paramName 版本号参数名称,默认为 v
  • paramType 生成版本的参数类型,默认为 version 有三个选项。 version: 在 package.jsonversion 作为版本号; guid: 生成唯一字符串版本号 ; timestamp: 生成时间戳版本号
  • suffix 需要在资源文件添加的版本号 默认为 ['css', 'js']

Keywords

FAQs

Last updated on 24 Aug 2020

Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc