gulp-manifest
Advanced tools
Comparing version 0.0.6 to 0.0.7
12
index.js
@@ -9,2 +9,3 @@ "use strict"; | ||
slash = require('slash'), | ||
minimatch = require('minimatch'), | ||
lineBreak = '\n'; | ||
@@ -20,2 +21,3 @@ | ||
var hasher = crypto.createHash('sha256'); | ||
var prefixCache = options.prefixCache || ''; | ||
@@ -43,7 +45,9 @@ if (options.timestamp) { | ||
if (exclude.indexOf(file.relative) >= 0) { | ||
return; | ||
} | ||
for (var i = 0; i < exclude.length; i++) { | ||
if(minimatch(file.relative, exclude[i])){ | ||
return; | ||
} | ||
} | ||
contents.push(encodeURI(slash(file.relative))); | ||
contents.push(encodeURI(slash(prefixCache + file.relative))); | ||
@@ -50,0 +54,0 @@ if (options.hash) { |
{ | ||
"name": "gulp-manifest", | ||
"version": "0.0.6", | ||
"version": "0.0.7", | ||
"description": "Generate HTML5 Cache Manifest files", | ||
@@ -31,4 +31,5 @@ "main": "index.js", | ||
"gulp-util": "~2.2.6", | ||
"slash": "^0.1.1" | ||
"slash": "^0.1.1", | ||
"minimatch": "~2.0.1" | ||
} | ||
} |
@@ -90,3 +90,3 @@ # gulp-manifest | ||
preferOnline: true, | ||
network: ['http://*', 'https://*', '*'], | ||
network: ['*'], | ||
filename: 'app.manifest', | ||
@@ -113,4 +113,2 @@ exclude: 'app.manifest' | ||
NETWORK: | ||
http://* | ||
https://* | ||
* | ||
@@ -117,0 +115,0 @@ |
@@ -19,3 +19,8 @@ var fs = require('fs'), | ||
describe('gulp-manifest', function() { | ||
var fileNames = ['file1.js', 'file2.js', 'file3.js', 'file4.js']; | ||
var fileNames = ['file1.js', 'file2.js', 'file3.js', 'file4.js', | ||
'exclude/exclude1.js','exclude/exclude2.js', | ||
'exclude/children1/exclude3.js', | ||
'children2/include1.js','children2/exclude4.js', | ||
'children2/children3/include2.js','children2/children3/exclude5.js' | ||
]; | ||
var fakeFiles = fileNames.map(createFakeFile); | ||
@@ -124,2 +129,34 @@ | ||
}); | ||
it('Should exclude special files', function(done) { | ||
var stream = manifestPlugin({ | ||
filename: 'cache.manifest', | ||
exclude: ['file2.js','exclude/**',"children2/**/exclude*.js"], | ||
hash: true, | ||
network: ['http://*', 'https://*', '*'], | ||
preferOnline: true | ||
}); | ||
stream.on('data', function(data) { | ||
data.should.be.an.instanceOf(gutil.File); | ||
data.relative.should.eql('cache.manifest'); | ||
var contents = data.contents.toString(); | ||
contents.should.startWith('CACHE MANIFEST'); | ||
contents.should.contain('CACHE:'); | ||
contents.should.contain('file1.js'); | ||
contents.should.not.contain('file2.js'); | ||
contents.should.contain('file3.js'); | ||
contents.should.contain('file4.js'); | ||
contents.should.contain('# hash: '); | ||
contents.should.not.contain('exclude'); | ||
contents.should.contain('include1.js'); | ||
contents.should.contain('include2.js'); | ||
}); | ||
stream.once('end', done); | ||
fakeFiles.forEach(stream.write.bind(stream)); | ||
stream.end(); | ||
}); | ||
}); |
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
11909
228
5
121
+ Addedminimatch@~2.0.1
+ Addedbalanced-match@1.0.2(transitive)
+ Addedbrace-expansion@1.1.11(transitive)
+ Addedconcat-map@0.0.1(transitive)
+ Addedminimatch@2.0.10(transitive)