New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

gulp-tpl-rev

Package Overview
Dependencies
Maintainers
1
Versions
10
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

gulp-tpl-rev - npm Package Compare versions

Comparing version 1.0.6 to 1.0.7

.travis.yml

2

package.json
{
"name": "gulp-tpl-rev",
"version": "1.0.6",
"version": "1.0.7",
"description": "template resource url revisioning by appending content hash to filenames: unicorn.css => unicorn.css?_v=1",

@@ -5,0 +5,0 @@ "main": "dist/index.js",

@@ -0,3 +1,5 @@

# gulp-tpl-rev [![Build Status](https://api.travis-ci.org/kwoktung/gulp-tpl-rev.svg?branch=master)](https://travis-ci.org/kwoktung/gulp-tpl-rev)
> Static asset revisioning by appending content hash to filenames
> ``unicorn.css` → `unicorn.css?_v=1`
> ``unicorn.css` → `unicorn.css?_v=995025`

@@ -14,9 +16,25 @@ ## Install

const gulp = require('gulp');
const rev = require('gulp-tpl-rev');
const tpl = require('gulp-tpl-rev');
const crypto = require('crypto');
const path = require('path');
const fs= require('fs')
exports.default = () => (
gulp.src('src/*.html')
.pipe(rev({ name: '_v', hash: function() { return '1' }}))
.pipe(tpl({
name: '_v',
hash: function(pathname) {
const { ext } = path.parse(pathname)
const fullpath = path.join(__dirname, 'wwwroot', pathname)
if (fs.existsSync(fullpath)) {
const file = fs.readFileSync(fullpath, 'utf8')
const md5 = crypto.createHash('md5');
md5.update(file);
return md5.digest('hex').slice(0, 6)
}
return ""
}
}))
.pipe(gulp.dest('dist'))
);
```
SocketSocket SOC 2 Logo

Product

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

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc