Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 5 additions & 5 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ var path = require('path');

var CleanCSS = require('clean-css');
var program = require('commander');
var glob = require('glob');

var COMPATIBILITY_PATTERN = /([\w\.]+)=(\w+)/g;
var lineBreak = require('os').EOL;
Expand Down Expand Up @@ -212,15 +211,16 @@ function findArgumentTo(option, rawArgs, args) {
}

function expandGlobs(paths) {
var globPatterns = paths.filter(function (path) { return path[0] != '!'; });
var globPatterns = paths.filter(function (path) { return path.charAt(0) !== '!'; });
var ignoredGlobPatterns = paths
.filter(function (path) { return path[0] == '!'; })
.filter(function (path) { return path.charAt(0) === '!'; })
.map(function (path) { return path.substring(1); });

return globPatterns.reduce(function (accumulator, path) {
var expandedWithSource =
glob.sync(path, { ignore: ignoredGlobPatterns, nodir: true, nonull: true })
.map(function (expandedPath) { return { expanded: expandedPath, source: path }; });
fs.globSync(path, { exclude: ignoredGlobPatterns, withFileTypes: true })
.filter(function (path) { return path.isFile(); })
.map(function (expandedPath) { return { expanded: expandedPath.name, source: path }; });

return accumulator.concat(expandedWithSource);
}, []);
Expand Down
Loading