Skip to content

Commit a30e0ac

Browse files
committed
0.0.6: ".min" sufix processing was added
1 parent 8fc62c7 commit a30e0ac

File tree

3 files changed

+11
-7
lines changed

3 files changed

+11
-7
lines changed

index.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ function plugin(keepQuantity) {
1111
var lists = {};
1212

1313
return through.obj(function (file, enc, cb) {
14-
var regex = new RegExp('^(.*)-[0-9a-f]{8}\\' + path.extname(file.path) + '$');
14+
var regex = new RegExp('^(.*)-[0-9a-f]{8}(?:\\.min)?\\' + path.extname(file.path) + '$');
1515
if (regex.test(file.path)) {
1616
var identifier = regex.exec(file.path)[1];
1717
if (lists[identifier] === undefined) {

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "gulp-rev-outdated",
3-
"version": "0.0.5",
3+
"version": "0.0.6",
44
"description": "Old static asset revision files filter",
55
"license": "MIT",
66
"repository": {

test.js

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ var assets = [
1212
{path: 'css/style-a42f5380.css', time: 1403184303451},
1313
{path: 'css/style-1d87bebe.css', time: 1222222222222},
1414
{path: 'css/style-11111111.css', time: 1111111111111},
15+
{path: 'css/style-11111111.min.css', time: 1111111111111},
1516
{path: 'css/style-00000000.css', time: 0},
1617
// Additional unique file
1718
{path: 'css/vendor.css', time: 0},
@@ -21,6 +22,7 @@ var assets = [
2122
{path: 'css/vendor-a42f5380.css', time: 1403184303451},
2223
{path: 'css/vendor-1d87bebe.css', time: 1222222222222},
2324
{path: 'css/vendor-11111111.css', time: 1111111111111},
25+
{path: 'css/vendor-11111111.min.css', time: 1111111111111},
2426
{path: 'css/vendor-00000000.css', time: 0},
2527
// Test nested files
2628
{path: 'css/fonts/fontstyle.css', time: 0},
@@ -30,6 +32,7 @@ var assets = [
3032
{path: 'css/fonts/fontstyle-a42f5380.css', time: 1403184303451},
3133
{path: 'css/fonts/fontstyle-1d87bebe.css', time: 1222222222222},
3234
{path: 'css/fonts/fontstyle-11111111.css', time: 1111111111111},
35+
{path: 'css/fonts/fontstyle-11111111.min.css', time: 1111111111111},
3336
{path: 'css/fonts/fontstyle-00000000.css', time: 0},
3437
// Try to trip regex
3538
{path: 'css/try-to-trip-regex.css', time: 0},
@@ -39,6 +42,7 @@ var assets = [
3942
{path: 'css/try-to-trip-regex-a42f5380.css', time: 1403184303451},
4043
{path: 'css/try-to-trip-regex-1d87bebe.css', time: 1222222222222},
4144
{path: 'css/try-to-trip-regex-11111111.css', time: 1111111111111},
45+
{path: 'css/try-to-trip-regex-11111111.min.css', time: 1111111111111},
4246
{path: 'css/try-to-trip-regex-00000000.css', time: 0}
4347
];
4448

@@ -50,7 +54,7 @@ var fileCount;
5054

5155
it('should filter 15 files', function (cb) {
5256
keepQuantity = 1;
53-
filteredQuantity = 6 * uniqueFiles - keepQuantity * uniqueFiles;
57+
filteredQuantity = 7 * uniqueFiles - keepQuantity * uniqueFiles;
5458
fileCount = 0;
5559

5660
var stream = initStream(revOutdated(keepQuantity));
@@ -67,7 +71,7 @@ it('should filter 15 files', function (cb) {
6771

6872
it('should filter 12 files using default keepQuantity option', function (cb) {
6973
keepQuantity = undefined;
70-
filteredQuantity = 6 * uniqueFiles - 2 * uniqueFiles;
74+
filteredQuantity = 7 * uniqueFiles - 2 * uniqueFiles;
7175
fileCount = 0;
7276

7377
var stream = initStream(revOutdated());
@@ -84,15 +88,15 @@ it('should filter 12 files using default keepQuantity option', function (cb) {
8488

8589
it('should filter correct files', function (cb) {
8690
keepQuantity = 3;
87-
filteredQuantity = 6 * uniqueFiles - keepQuantity * uniqueFiles;
91+
filteredQuantity = 7 * uniqueFiles - keepQuantity * uniqueFiles;
8892
fileCount = 0;
8993

9094
var stream = initStream(revOutdated(keepQuantity));
9195

9296
stream.on('data', function (file) {
9397
streamDataCheck(file);
9498
assert(
95-
/\/(style|vendor|fontstyle|try-to-trip-regex)-(1d87bebe|11111111|00000000)\.css/.test(file.path),
99+
/\/(style|vendor|fontstyle|try-to-trip-regex)-(1d87bebe|11111111|00000000)(?:\.min)?\.css/.test(file.path),
96100
'should filter correct files'
97101
);
98102
});
@@ -118,7 +122,7 @@ function initStream(stream) {
118122

119123
function streamDataCheck(file) {
120124
assert(
121-
/\/(style|vendor|fontstyle|try-to-trip-regex)-[0-9a-f]{8}\.css/.test(file.path),
125+
/\/(style|vendor|fontstyle|try-to-trip-regex)-[0-9a-f]{8}(?:\.min)?\.css/.test(file.path),
122126
'should filter only revisioned files'
123127
);
124128
fileCount++;

0 commit comments

Comments
 (0)