Skip to content

Commit 78cf600

Browse files
santanabornRyanZim
authored andcommitted
Allow passing a number to --poll to set poll interval
1 parent cc78d46 commit 78cf600

File tree

2 files changed

+6
-4
lines changed

2 files changed

+6
-4
lines changed

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ cat input.css | postcss [OPTIONS] > output.css
6060
|`-s, --syntax`|`{String}`|`undefined`|Custom PostCSS Syntax|
6161
|`-t, --stringifier`|`{String}`|`undefined`|Custom PostCSS Stringifier|
6262
|`-w, --watch`|`{Boolean}`|`false`|Enable Watch Mode|
63-
|`--poll`|`{Boolean}`|`false`|Use polling for file watching|
63+
|`--poll`|`{Boolean|Number}`|`100`|Use polling for file watching. Can optionally pass polling interval; default 100 ms|
6464
|`-u, --use`|`{Array}`|`[]`|PostCSS Plugins|
6565
|`-m, --map`|`{Boolean}`|`{ inline: true }`|External Sourcemaps|
6666
|`--no-map`|`{Boolean}`|`false`|Disable Sourcemaps|

index.js

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -92,8 +92,7 @@ Usage:
9292
type: 'boolean'
9393
})
9494
.option('poll', {
95-
desc: 'Use polling for file watching',
96-
type: 'boolean'
95+
desc: 'Use polling for file watching. Can optionally pass polling interval; default 100 ms',
9796
})
9897
.option('x', {
9998
alias: 'ext',
@@ -196,7 +195,10 @@ Promise.resolve()
196195
if (argv.watch) {
197196
const watcher = chokidar.watch(
198197
input.concat(dependencies(results)),
199-
{ usePolling: argv.poll }
198+
{
199+
usePolling: argv.poll,
200+
interval: argv.poll && typeof argv.poll === 'number' ? argv.poll : 100
201+
}
200202
)
201203

202204
if (config.file) watcher.add(config.file)

0 commit comments

Comments
 (0)