File tree Expand file tree Collapse file tree 2 files changed +8
-6
lines changed
packages/gatsby/src/internal-plugins Expand file tree Collapse file tree 2 files changed +8
-6
lines changed Original file line number Diff line number Diff line change @@ -19,19 +19,20 @@ exports.createLayouts = async (
1919) => {
2020 const { createLayout, deleteLayout } = boundActionCreators
2121 const program = store . getState ( ) . program
22+ const exts = program . extensions . map ( e => `${ e . slice ( 1 ) } ` ) . join ( `,` )
2223 const layoutDirectory = systemPath . posix . join (
2324 program . directory ,
2425 `/src/layouts`
2526 )
26- const exts = program . extensions . map ( e => `${ e . slice ( 1 ) } ` ) . join ( `,` )
27+ const layoutGlob = `${ layoutDirectory } /**/*.{ ${ exts } }`
2728
2829 // Get initial list of files.
29- let files = await glob ( ` ${ layoutDirectory } /**/?( ${ exts } )` )
30+ let files = await glob ( layoutGlob )
3031 files . forEach ( file => _createLayout ( file , layoutDirectory , createLayout ) )
3132
3233 // Listen for new layouts to be added or removed.
3334 chokidar
34- . watch ( ` ${ layoutDirectory } /**/*.{ ${ exts } }` )
35+ . watch ( layoutGlob )
3536 . on ( `add` , path => {
3637 if ( ! _ . includes ( files , path ) ) {
3738 _createLayout ( path , layoutDirectory , createLayout )
Original file line number Diff line number Diff line change @@ -21,16 +21,17 @@ exports.createPagesStatefully = async (
2121) => {
2222 const { createPage, deletePage } = boundActionCreators
2323 const program = store . getState ( ) . program
24- const pagesDirectory = systemPath . posix . join ( program . directory , `/src/pages` )
2524 const exts = program . extensions . map ( e => `${ e . slice ( 1 ) } ` ) . join ( `,` )
25+ const pagesDirectory = systemPath . posix . join ( program . directory , `/src/pages` )
26+ const pagesGlob = `${ pagesDirectory } /**/*.{${ exts } }`
2627
2728 // Get initial list of files.
28- let files = await glob ( ` ${ pagesDirectory } /**/?( ${ exts } )` )
29+ let files = await glob ( pagesGlob )
2930 files . forEach ( file => _createPage ( file , pagesDirectory , createPage ) )
3031
3132 // Listen for new component pages to be added or removed.
3233 chokidar
33- . watch ( ` ${ pagesDirectory } /**/*.{ ${ exts } }` )
34+ . watch ( pagesGlob )
3435 . on ( `add` , path => {
3536 if ( ! _ . includes ( files , path ) ) {
3637 _createPage ( path , pagesDirectory , createPage )
You can’t perform that action at this time.
0 commit comments