@@ -161,6 +161,10 @@ let commands = {
161
161
'--input' : { type : String , description : 'Input file' } ,
162
162
'--output' : { type : String , description : 'Output file' } ,
163
163
'--watch' : { type : Boolean , description : 'Watch for changes and rebuild as needed' } ,
164
+ '--poll' : {
165
+ type : Boolean ,
166
+ description : 'Use polling instead of filesystem events when watching' ,
167
+ } ,
164
168
'--content' : {
165
169
type : String ,
166
170
description : 'Content paths to use for removing unused classes' ,
@@ -187,6 +191,7 @@ let commands = {
187
191
'-o' : '--output' ,
188
192
'-m' : '--minify' ,
189
193
'-w' : '--watch' ,
194
+ '-p' : '--poll' ,
190
195
} ,
191
196
} ,
192
197
}
@@ -367,8 +372,14 @@ async function build() {
367
372
let input = args [ '--input' ]
368
373
let output = args [ '--output' ]
369
374
let shouldWatch = args [ '--watch' ]
375
+ let shouldPoll = args [ '--poll' ]
376
+ let shouldCoalesceWriteEvents = shouldPoll || process . platform === 'win32'
370
377
let includePostCss = args [ '--postcss' ]
371
378
379
+ // Polling interval in milliseconds
380
+ // Used only when polling or coalescing add/change events on Windows
381
+ let pollInterval = 10
382
+
372
383
// TODO: Deprecate this in future versions
373
384
if ( ! input && args [ '_' ] [ 1 ] ) {
374
385
console . error ( '[deprecation] Running tailwindcss without -i, please provide an input file.' )
@@ -746,14 +757,15 @@ async function build() {
746
757
}
747
758
748
759
watcher = chokidar . watch ( [ ...contextDependencies , ...extractFileGlobs ( config ) ] , {
760
+ usePolling : shouldPoll ,
761
+ interval : shouldPoll ? pollInterval : undefined ,
749
762
ignoreInitial : true ,
750
- awaitWriteFinish :
751
- process . platform === 'win32'
752
- ? {
753
- stabilityThreshold : 50 ,
754
- pollInterval : 10 ,
755
- }
756
- : false ,
763
+ awaitWriteFinish : shouldCoalesceWriteEvents
764
+ ? {
765
+ stabilityThreshold : 50 ,
766
+ pollInterval : pollInterval ,
767
+ }
768
+ : false ,
757
769
} )
758
770
759
771
let chain = Promise . resolve ( )
0 commit comments