Skip to content

Commit

Permalink
Pass excludePaths to multiGlob helper
Browse files Browse the repository at this point in the history
  • Loading branch information
zzarcon committed Feb 22, 2016
1 parent c11a106 commit 06478c1
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions lib/service-worker.js
Original file line number Diff line number Diff line change
Expand Up @@ -47,8 +47,9 @@ BroccoliServiceWorker.prototype.write = function(readTree, destDir) {
var fallback = this.fallback;
var precacheURLs = this.precacheURLs;
var serviceWorkerFile = this.serviceWorkerFile;
var excludePaths = this.excludePaths;
var serviceWorkerTree = funnel(this.inTree, {
exclude: this.excludePaths
exclude: excludePaths
});
var swIncludeFiles = this.swIncludeFiles;
var swIncludeTree = this.swIncludeTree;
Expand All @@ -65,7 +66,7 @@ BroccoliServiceWorker.prototype.write = function(readTree, destDir) {
}
lines.push("var urlsToPrefetch = [");
lines.push(" '/',");
getFilesRecursively(srcDir, [ "**/*" ]).forEach(function (file, idx, array) {
getFilesRecursively(srcDir, [ "**/*" ], excludePaths).forEach(function (file, idx, array) {
lines.push(createArrayLine(' '+JSON.stringify(file), idx, array.length));
});
lines.push("];");
Expand Down Expand Up @@ -166,9 +167,9 @@ function escapeRegExp(string){
return string.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
}

function getFilesRecursively(dir, globPatterns) {
function getFilesRecursively(dir, globPatterns, excludePaths) {
try {
return helpers.multiGlob(globPatterns, { cwd: dir }).filter(function(file){
return helpers.multiGlob(globPatterns, { cwd: dir, ignore: excludePaths }).filter(function(file){
var srcFile = path.join(dir, file);
var stat = fs.lstatSync(srcFile);
return (stat.isFile() || stat.isSymbolicLink());
Expand Down

0 comments on commit 06478c1

Please sign in to comment.