@@ -16,22 +16,37 @@ import { getThemeOptions } from '../utils/options.js'
16
16
async function watchVendor ( ) {
17
17
try {
18
18
const options = getThemeOptions ( )
19
- chokidar . watch ( `${ options . vendorSrc } /css/**/*.css` , { ignoreInitial : true , awaitWriteFinish : false } ) . on ( 'all' , ( event , path ) => {
19
+ chokidar . watch ( `${ options . vendorSrc } /css` , {
20
+ ignored : ( path , stats ) => Boolean ( stats ?. isFile ( ) && ! path . endsWith ( '.css' ) ) ,
21
+ ignoreInitial : true ,
22
+ awaitWriteFinish : false
23
+ } ) . on ( 'all' , ( event , path ) => {
20
24
console . log ( `${ chalk . red ( event ) } ${ path } ` )
21
25
compileCss ( true )
22
26
} )
23
27
24
- chokidar . watch ( `${ options . vendorSrc } /js/**/*.js` , { ignoreInitial : true , awaitWriteFinish : false } ) . on ( 'all' , ( event , path ) => {
28
+ chokidar . watch ( `${ options . vendorSrc } /js` , {
29
+ ignored : ( path , stats ) => Boolean ( stats ?. isFile ( ) && ! path . endsWith ( '.js' ) ) ,
30
+ ignoreInitial : true ,
31
+ awaitWriteFinish : false
32
+ } ) . on ( 'all' , ( event , path ) => {
25
33
console . log ( `${ chalk . red ( event ) } ${ path } ` )
26
34
compileJs ( true )
27
35
} )
28
36
29
- chokidar . watch ( `${ options . vendorSrc } /scss/**/*.scss` , { ignoreInitial : true } ) . on ( 'all' , ( event , path ) => {
37
+ chokidar . watch ( `${ options . vendorSrc } /scss` , {
38
+ ignored : ( path , stats ) => Boolean ( stats ?. isFile ( ) && ! path . endsWith ( '.scss' ) ) ,
39
+ ignoreInitial : true
40
+ } ) . on ( 'all' , ( event , path ) => {
30
41
console . log ( `${ chalk . red ( event ) } ${ path } ` )
31
42
compileScss ( true )
32
43
} )
33
44
34
- chokidar . watch ( `${ process . cwd ( ) } /${ options . themeFolder } /**/fields.js` , { ignoreInitial : true , awaitWriteFinish : false } ) . on ( 'all' , ( event , path ) => {
45
+ chokidar . watch ( `${ process . cwd ( ) } /${ options . themeFolder } ` , {
46
+ ignored : ( path , stats ) => Boolean ( stats ?. isFile ( ) && ! path . endsWith ( 'fields.js' ) ) ,
47
+ ignoreInitial : true ,
48
+ awaitWriteFinish : false
49
+ } ) . on ( 'all' , ( event , path ) => {
35
50
console . log ( `${ chalk . red ( event ) } ${ path } ` )
36
51
compileFieldsJs ( path , true )
37
52
} )
0 commit comments