gulp-rev-all
Advanced tools
Comparing version 0.8.4 to 0.8.5
{ | ||
"name": "gulp-rev-all", | ||
"version": "0.8.4", | ||
"version": "0.8.5", | ||
"description": "Static asset revisioning by appending content hash to filenames: unicorn.css => unicorn.098f6bcd.css, also re-writes references in each file to new reved name.", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
@@ -153,3 +153,3 @@ # [gulp](https://github.com/wearefractal/gulp)-rev-all [![Build Status](https://travis-ci.org/smysnk/gulp-rev-all.png?branch=master)](https://travis-ci.org/smysnk/gulp-rev-all) | ||
Don't rename file or update refrences in files matching these rules | ||
Don't rename, search or update refrences in files matching these rules | ||
Type: `Array of (Regex and/or String)` | ||
@@ -170,3 +170,8 @@ Default: `[ /^\/favicon.ico$/ ]` | ||
#### options.dontSearchReference | ||
Don't search for references in files matching these rules | ||
Type: `Array of (Regex and/or String)` | ||
Default: `[]` | ||
In some cases, you may not want to rev your `*.html` files: | ||
@@ -173,0 +178,0 @@ |
@@ -17,2 +17,3 @@ var gracefulfs = require('graceful-fs'); | ||
'dontUpdateReference': [], | ||
'dontSearchReference': [], | ||
'fileNameVersion': 'version.json', | ||
@@ -127,4 +128,4 @@ 'fileNameManifest': 'rev-manifest.json', | ||
// Don't try and resolve references in binary files | ||
if (this.Tool.is_binary_file(fileResolveReferencesIn)) return; | ||
// Don't try and resolve references in binary files or files that have been blacklisted | ||
if (this.Tool.is_binary_file(fileResolveReferencesIn) || !this.shouldSearchReference(fileResolveReferencesIn)) return; | ||
@@ -327,2 +328,26 @@ var referenceGroupRelative = []; | ||
/** | ||
* Determines if a particular reference should be updated across assets based on dontUpdateReference supplied in options. | ||
*/ | ||
Revisioner.prototype.shouldSearchReference = function (file) { | ||
var filename = this.Tool.get_relative_path(file.base, file.path); | ||
for (var i = this.options.dontGlobal.length; i--;) { | ||
var regex = (this.options.dontGlobal[i] instanceof RegExp) ? this.options.dontGlobal[i] : new RegExp(this.options.dontGlobal[i] + '$', 'ig'); | ||
if (filename.match(regex)) { | ||
return false; | ||
} | ||
} | ||
for (var i = this.options.dontSearchReference.length; i--;) { | ||
var regex = (this.options.dontSearchReference[i] instanceof RegExp) ? this.options.dontSearchReference[i] : new RegExp(this.options.dontSearchReference[i] + '$', 'ig'); | ||
if (filename.match(regex)) { | ||
return false; | ||
} | ||
} | ||
return true; | ||
}; | ||
return Revisioner; | ||
@@ -329,0 +354,0 @@ |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
731149
1487
315