@@ -142,37 +142,56 @@ function expandTailwindAtRules(context, registerDependency) {
142
142
143
143
// ---
144
144
145
- for ( let maybeGlob of context . candidateFiles ) {
146
- let {
147
- is : { glob : isGlob } ,
148
- base,
149
- } = parseGlob ( maybeGlob )
150
-
151
- if ( isGlob ) {
152
- // register base dir as `dependency` _and_ `context-dependency` for
153
- // increased compatibility
154
- registerDependency ( path . resolve ( base ) )
155
- registerDependency ( path . resolve ( base ) , 'context-dependency' )
156
- } else {
157
- registerDependency ( path . resolve ( maybeGlob ) )
145
+ if ( sharedState . env . TAILWIND_DISABLE_TOUCH ) {
146
+ for ( let maybeGlob of context . candidateFiles ) {
147
+ let {
148
+ is : { glob : isGlob } ,
149
+ base,
150
+ } = parseGlob ( maybeGlob )
151
+
152
+ if ( isGlob ) {
153
+ // register base dir as `dependency` _and_ `context-dependency` for
154
+ // increased compatibility
155
+ registerDependency ( path . resolve ( base ) )
156
+ registerDependency ( path . resolve ( base ) , 'context-dependency' )
157
+ } else {
158
+ registerDependency ( path . resolve ( maybeGlob ) )
159
+ }
160
+ }
161
+
162
+ env . DEBUG && console . time ( 'Finding changed files' )
163
+ let files = fastGlob . sync ( context . candidateFiles )
164
+ for ( let file of files ) {
165
+ let prevModified = sharedState . fileModifiedCache . has ( file )
166
+ ? sharedState . fileModifiedCache . get ( file )
167
+ : - Infinity
168
+ let modified = fs . statSync ( file ) . mtimeMs
169
+
170
+ if ( ! context . scannedContent || modified > prevModified ) {
171
+ context . changedFiles . add ( file )
172
+ sharedState . fileModifiedCache . set ( file , modified )
173
+ }
174
+ }
175
+ context . scannedContent = true
176
+ env . DEBUG && console . timeEnd ( 'Finding changed files' )
177
+ } else {
178
+ // Register our temp file as a dependency — we write to this file
179
+ // to trigger rebuilds.
180
+ if ( context . touchFile ) {
181
+ registerDependency ( context . touchFile )
158
182
}
159
- }
160
183
161
- env . DEBUG && console . time ( 'Finding changed files' )
162
- let files = fastGlob . sync ( context . candidateFiles )
163
- for ( let file of files ) {
164
- let prevModified = sharedState . fileModifiedCache . has ( file )
165
- ? sharedState . fileModifiedCache . get ( file )
166
- : - Infinity
167
- let modified = fs . statSync ( file ) . mtimeMs
168
-
169
- if ( ! context . scannedContent || modified > prevModified ) {
170
- context . changedFiles . add ( file )
171
- sharedState . fileModifiedCache . set ( file , modified )
184
+ // If we're not set up and watching files ourselves, we need to do
185
+ // the work of grabbing all of the template files for candidate
186
+ // detection.
187
+ if ( ! context . scannedContent ) {
188
+ let files = fastGlob . sync ( context . candidateFiles )
189
+ for ( let file of files ) {
190
+ context . changedFiles . add ( file )
191
+ }
192
+ context . scannedContent = true
172
193
}
173
194
}
174
- context . scannedContent = true
175
- env . DEBUG && console . timeEnd ( 'Finding changed files' )
176
195
177
196
// ---
178
197
0 commit comments