gulp-rev-all
Advanced tools
Comparing version 0.8.21 to 0.8.22
{ | ||
"name": "gulp-rev-all", | ||
"version": "0.8.21", | ||
"version": "0.8.22", | ||
"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", |
@@ -16,3 +16,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) | ||
This project was forked from [gulp-rev](https://github.com/sindresorhus/gulp-rev) to add reference processing and rewriting functionality. | ||
It is the philosophy of `gulp-rev` that concerns should be seperated between revisioning the files and re-writing references to those files. `gulp-rev-all` does not agree with this, we believe you need analyze each revisioned files' references, to calculate a final hash for caching purposes. | ||
It is the philosophy of `gulp-rev` that concerns should be seperated between revisioning the files and re-writing references to those files. `gulp-rev-all` does not agree with this, we believe you need to analyze each revisioned files' references, to calculate a final hash for caching purposes. | ||
@@ -68,7 +68,9 @@ ### Consider the following example: | ||
var aws = { | ||
"key": "AKIAI3Z7CUAFHG53DMJA", | ||
"secret": "acYxWRu5RRa6CwzQuhdXEfTpbQA+1XQJ7Z1bGTCx", | ||
"bucket": "bucket-name", | ||
"region": "us-standard", | ||
"distributionId": "E1SYAKGEMSK3OD" | ||
"params": { | ||
"Bucket": "bucket-name" | ||
}, | ||
"accessKeyId": "AKIAI3Z7CUAFHG53DMJA", | ||
"secretAccessKey": "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", | ||
"distributionId": "E1SYAKGEMSK3OD", | ||
"region": "us-standard", | ||
}; | ||
@@ -311,3 +313,3 @@ | ||
In some cases, false-positives may occur. Strings that are similar to a file reference may be incorrectly be replaced.<br/> | ||
In some cases, false-positives may occur. Strings that are similar to a file reference may be incorrectly replaced.<br/> | ||
@@ -354,3 +356,3 @@ In the example below, the 2nd instance of 'xyz' is not reference to the file xyz.js: | ||
The replacer function's job is to replace references to revisioned files. The paremeters are as folows:<br/> | ||
The replacer function's job is to replace references to revisioned files. The paremeters are as follows:<br/> | ||
@@ -357,0 +359,0 @@ ```fragment```: a file fragment as created in the annotator function.<br/> |
@@ -44,3 +44,3 @@ var Gutil = require('gulp-util'); | ||
var nonFileNameChar = '[^a-zA-Z0-9\\.\\-\\_\/]'; | ||
var nonFileNameChar = '[^a-zA-Z0-9\\.\\-\\_\\/]'; | ||
var qoutes = '\'|"'; | ||
@@ -256,12 +256,12 @@ | ||
fileResolveReferencesIn.revReferencePaths[reference.path] = { | ||
'regExp': regExps[j], | ||
'regExps': [regExps[j]], | ||
'file': reference.file, | ||
'path': reference.path | ||
}; | ||
this.log('gulp-rev-all:', 'Found', referenceType, 'reference [', Gutil.colors.magenta(reference.path), '] -> [', Gutil.colors.green(reference.file.path), '] in [', Gutil.colors.blue(fileResolveReferencesIn.revPathOriginal) ,']'); | ||
} else if (fileResolveReferencesIn.revReferencePaths[reference.path].file.revPathOriginal !== reference.file.revPathOriginal) { | ||
this.log('gulp-rev-all:', 'Possible ambiguous refrence detected [', Gutil.colors.red(fileResolveReferencesIn.revReferencePaths[reference.path].path), ' (', fileResolveReferencesIn.revReferencePaths[reference.path].file.revPathOriginal, ')] <-> [', Gutil.colors.red(reference.path) ,'(', Gutil.colors.red(reference.file.revPathOriginal), ')]'); | ||
this.log('gulp-rev-all:', 'Found', referenceType, 'reference [', Gutil.colors.magenta(reference.path), '] -> [', Gutil.colors.green(reference.file.path), '] in [', Gutil.colors.blue(fileResolveReferencesIn.revPathOriginal), ']'); | ||
} else if (fileResolveReferencesIn.revReferencePaths[reference.path].file.revPathOriginal === reference.file.revPathOriginal) { | ||
// Append the other regexes to account for inconsitent use | ||
fileResolveReferencesIn.revReferencePaths[reference.path].regExps.push(regExps[j]); | ||
} else { | ||
this.log('gulp-rev-all:', 'Possible ambiguous refrence detected [', Gutil.colors.red(fileResolveReferencesIn.revReferencePaths[reference.path].path), ' (', fileResolveReferencesIn.revReferencePaths[reference.path].file.revPathOriginal, ')] <-> [', Gutil.colors.red(reference.path), '(', Gutil.colors.red(reference.file.revPathOriginal), ')]'); | ||
} | ||
@@ -350,4 +350,4 @@ } | ||
// Don't try and update references in binary files | ||
if (this.Tool.is_binary_file(file)) { | ||
// Don't try and update references in binary files or blacklisted files | ||
if (this.Tool.is_binary_file(file) || !this.shouldSearchFile(file)) { | ||
return; | ||
@@ -380,4 +380,6 @@ } | ||
for(var i = 0; i < annotatedContent.length; i++) { | ||
this.options.replacer(annotatedContent[i], reference.regExp, noExtReplace, reference.file); | ||
for(var i = 0; i < annotatedContent.length; i++){ | ||
for(var j = 0; j < reference.regExps.length; j++){ | ||
this.options.replacer(annotatedContent[i], reference.regExps[j], noExtReplace, reference.file); | ||
} | ||
} | ||
@@ -388,3 +390,3 @@ } | ||
contents = annotatedContent.map(function(annotation) {return annotation.contents;}).join(''); | ||
contents = annotatedContent.map(function(annotation) { return annotation.contents; }).join(''); | ||
file.contents = new Buffer(contents); | ||
@@ -399,3 +401,3 @@ | ||
var filename = this.Tool.get_relative_path(file.base, file.path); | ||
var filename = this.Tool.get_relative_path(file.base, file.revPathOriginal); | ||
@@ -425,3 +427,3 @@ for (var i = this.options.dontGlobal.length; i--;) { | ||
var filename = this.Tool.get_relative_path(file.base, file.path); | ||
var filename = this.Tool.get_relative_path(file.base, file.revPathOriginal); | ||
@@ -450,3 +452,3 @@ for (var i = this.options.dontGlobal.length; i--;) { | ||
var filename = this.Tool.get_relative_path(file.base, file.path); | ||
var filename = this.Tool.get_relative_path(file.base, file.revPathOriginal); | ||
@@ -453,0 +455,0 @@ for (var i = this.options.dontGlobal.length; i--;) { |
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
740465
1651
396