Comparing version 0.3.1 to 0.4.0
@@ -206,17 +206,21 @@ "use strict"; | ||
var processFilter = function (filter) { | ||
if (!filter) { | ||
var unixifyPath = function (filePath) { | ||
return filePath.replace(/\\/g, "/"); | ||
}; | ||
var processFilter = function (filters, baseDir) { | ||
if (!filters) { | ||
return null; | ||
} | ||
var filters = filter.split(",").map(function (s) { | ||
return s.trim(); | ||
}); | ||
if (typeof filters == "string") { | ||
filters = [filters]; | ||
} | ||
return function (filePath) { | ||
var relativeFilePath = path.relative(baseDir, filePath); | ||
for (var i = 0; i < filters.length; i++) { | ||
if (filters[i].indexOf("*") < 0) { | ||
if (filePath.toLowerCase().indexOf(filters[i]) >= 0) { | ||
return true; | ||
} | ||
} else if (minimatch(path.basename(filePath), filters[i])) { | ||
if (minimatch(unixifyPath(relativeFilePath), unixifyPath(filters[i]))) { | ||
return true; | ||
@@ -229,3 +233,3 @@ } | ||
var initOptions = function (options) { | ||
var initOptions = function (options, baseDir) { | ||
// Store global options. | ||
@@ -236,4 +240,4 @@ // This is to prevent having to pass around data for cross-cutting concerns (i.e. logging) | ||
var includeFilters = processFilter(_options.include); | ||
var excludeFilters = processFilter(_options.exclude); | ||
var includeFilters = processFilter(_options.include, baseDir); | ||
var excludeFilters = processFilter(_options.exclude, baseDir); | ||
@@ -277,3 +281,3 @@ _options.shouldBeExcluded = function (filePath) { | ||
initOptions(options); | ||
initOptions(options, baseDir); | ||
@@ -394,3 +398,3 @@ if (!fsutil.existsSync(baseDir)) { | ||
initOptions(options); | ||
initOptions(options, directory); | ||
@@ -417,3 +421,3 @@ var serializer = serializerFactory.getSerializer(options.manifestFormat); | ||
initOptions(options); | ||
initOptions(options, directory); | ||
@@ -420,0 +424,0 @@ var serializer = serializerFactory.getSerializer(options.manifestFormat); |
{ | ||
"name": "hashly", | ||
"version": "0.3.1", | ||
"version": "0.4.0", | ||
"description": "Renames static files with a hashcode for cache busting", | ||
@@ -5,0 +5,0 @@ "directories": { |
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
38161
17