From 897874564e7c93c231d679bcc6dfad616404656a Mon Sep 17 00:00:00 2001 From: Ryan Garant Date: Wed, 19 Dec 2018 15:48:18 -0800 Subject: [PATCH] Add --include-dotfiles option to allow glob to match files/dirs that begin with '.' --- README.md | 17 +++++++++-------- index.js | 5 ++++- lib/args.js | 4 ++++ 3 files changed, 17 insertions(+), 9 deletions(-) diff --git a/README.md b/README.md index 372170c..b07b239 100644 --- a/README.md +++ b/README.md @@ -30,14 +30,15 @@ Usage: postcss ... [OPTIONS] --replace Basic options: - -o, --output Output file [string] - -d, --dir Output directory [string] - -r, --replace Replace (overwrite) the input file [boolean] - --map, -m Create an external sourcemap - --no-map Disable the default inline sourcemaps - --verbose Be verbose [boolean] - --watch, -w Watch files for changes and recompile as needed [boolean] - --env A shortcut for setting NODE_ENV [string] + -o, --output Output file [string] + -d, --dir Output directory [string] + -r, --replace Replace (overwrite) the input file [boolean] + --map, -m Create an external sourcemap + --no-map Disable the default inline sourcemaps + --verbose Be verbose [boolean] + --watch, -w Watch files for changes and recompile as needed [boolean] + --env A shortcut for setting NODE_ENV [string] + --include-dotfiles Enables glob to match files/dirs that begin with "." [boolean] Options for when not using a config file: -u, --use List of postcss plugins to use [array] diff --git a/index.js b/index.js index 86ce9f1..31ba4f4 100644 --- a/index.js +++ b/index.js @@ -53,7 +53,10 @@ Promise.resolve() if (argv.watch && !(argv.output || argv.replace || argv.dir)) { error('Cannot write to stdout in watch mode') } - if (input && input.length) return globber(input) + + if (input && input.length) { + return globber(input, { dot: argv.includeDotfiles }) + } if (argv.replace || argv.dir) { error( diff --git a/lib/args.js b/lib/args.js index 1855260..e85a211 100644 --- a/lib/args.js +++ b/lib/args.js @@ -58,6 +58,10 @@ Usage: type: 'boolean', conflicts: ['output', 'dir'] }) + .option('include-dotfiles', { + desc: 'Enables glob to match files/dirs that begin with "."', + type: 'boolean' + }) .alias('map', 'm') .describe('map', 'Create an external sourcemap') .describe('no-map', 'Disable the default inline sourcemaps')