Huge News!Announcing our $40M Series B led by Abstract Ventures.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.3 to 1.0.4

2

package.json
{
"name": "gulp-tpl-rev",
"version": "1.0.3",
"version": "1.0.4",
"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",

@@ -18,6 +18,15 @@ "use strict";

name: "_v",
hash: function (pahtname) { return "" + Date.now(); }
hash: function (pathname) { return "" + Date.now(); },
match: function (pathname) { return /^\/[^/]+/.test(pathname); }
};
function default_1(options) {
if (options === void 0) { options = defaultOptions; }
if (!options.name) {
options.name = defaultOptions.name;
}
if (!options.hash) {
options.hash = defaultOptions.hash;
}
if (!options.match) {
options.match = defaultOptions.match;
}
return through2_1.default.obj(function (file, _, cb) {

@@ -27,11 +36,15 @@ var tpl = "";

rewriter.on('startTag', function (token) {
var attr;
if (token.tagName === 'link') {
var attr = token.attrs.filter(function (attr) { return attr.name === "href"; })[0];
if (attr) {
var urlObject = url.parse(attr.value, true);
var query = urlObject.query;
query[options.name] = options.hash(urlObject.pathname);
attr.value = url.format(urlObject);
}
attr = token.attrs.filter(function (attr) { return attr.name === "href"; })[0];
}
else if (token.tagName === 'script') {
attr = token.attrs.filter(function (attr) { return attr.name === "src"; })[0];
}
if (attr && attr.value && options.match(attr.value)) {
var urlObject = url.parse(attr.value, true);
var query = urlObject.query;
query[options.name] = options.hash(urlObject.pathname);
attr.value = url.format(urlObject);
}
rewriter.emitStartTag(token);

@@ -38,0 +51,0 @@ });

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

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