
Security News
GitHub Actions Checkout Now Blocks Risky pull_request_target Checkouts
GitHub Actions checkout now blocks risky pull_request_target checkouts by default to help prevent pwn request supply chain attacks.
gulp-append-rev
Advanced tools
gulp打包静态资源添加版本号
$ npm install gulp-append-rev --save-dev
gulpfile.js
var rev = require('gulp-append-rev');
gulp.task('rev', function() {
gulp.src('./index.html')
.pipe(rev({root:"build"}))
.pipe(gulp.dest('.'));
});
gulp.task('rev', function() {
gulp.src('./index.html')
.pipe(rev())
.pipe(gulp.dest('.'));
});
通过正则匹配处理: (?:href|src)="(.*)[\?]rev=(.*)[\"]
页面中加载静态资源:
<!doctype html>
<html>
<head>
<link rel="stylesheet" type="text/css" href="style/style-one.css?rev=@@hash">
<script src="script/script-one.js?rev=@@hash"></script>
<script src="script/script-two.js"></script>
</head>
<body>
<div><p>hello, world!</p></div>
<script src="script/script-three.js?rev=@@hash"></script>
</body>
</html>
执行以后 gulp-append-rev:
<!doctype html>
<html>
<head>
<link rel="stylesheet" type="text/css" href="style/style-one.css?rev=d65aaba987e9c1eefeb4be9cfd34e0de">
<script src="script/script-one.js?rev=17a5da6c8a2d875cf48aefb722eefa07"></script>
<script src="script/script-two.js"></script>
</head>
<body>
<div><p>hello, world!</p></div>
<script src="script/script-three.js?rev=5cadf43edba6a97980d42331f9fffd17"></script>
</body>
</html>
该模块,通过修改模块gulp-rev-append而来,扩展参数配置功能
FAQs
We found that gulp-append-rev demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
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.

Security News
GitHub Actions checkout now blocks risky pull_request_target checkouts by default to help prevent pwn request supply chain attacks.

Product
Socket now supports Custom Roles and Repository Access Permissions so organizations can control who can access specific repositories and actions.

Product
Socket MCP now lets AI assistants review org alerts, investigate threats using the Socket threat feed, and inspect package files in addition to dependency scoring.