From c10aed9852e959205ef370dde96e036ca0041bbd Mon Sep 17 00:00:00 2001 From: Szymon Nowak Date: Wed, 31 Jan 2018 19:35:10 +0100 Subject: [PATCH 1/2] Fix issue with missing layouts on Windows --- .../component-layout-creator/gatsby-node.js | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/packages/gatsby/src/internal-plugins/component-layout-creator/gatsby-node.js b/packages/gatsby/src/internal-plugins/component-layout-creator/gatsby-node.js index 8af3386a4b53f..24ec2f5693178 100644 --- a/packages/gatsby/src/internal-plugins/component-layout-creator/gatsby-node.js +++ b/packages/gatsby/src/internal-plugins/component-layout-creator/gatsby-node.js @@ -19,19 +19,20 @@ exports.createLayouts = async ( ) => { const { createLayout, deleteLayout } = boundActionCreators const program = store.getState().program + const exts = program.extensions.map(e => `${e.slice(1)}`).join(`,`) const layoutDirectory = systemPath.posix.join( program.directory, `/src/layouts` ) - const exts = program.extensions.map(e => `${e.slice(1)}`).join(`,`) + const layoutGlob = `${layoutDirectory}/**/*.{${exts}}` // Get initial list of files. - let files = await glob(`${layoutDirectory}/**/?(${exts})`) + let files = await glob(layoutGlob) files.forEach(file => _createLayout(file, layoutDirectory, createLayout)) // Listen for new layouts to be added or removed. chokidar - .watch(`${layoutDirectory}/**/*.{${exts}}`) + .watch(layoutGlob) .on(`add`, path => { if (!_.includes(files, path)) { _createLayout(path, layoutDirectory, createLayout) From bdf2f3c33d779dec1ce6c0a6f00dc1a484e1fb7f Mon Sep 17 00:00:00 2001 From: Szymon Nowak Date: Thu, 1 Feb 2018 10:51:52 +0100 Subject: [PATCH 2/2] Fix issue with missing pages on Windows --- .../internal-plugins/component-page-creator/gatsby-node.js | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/packages/gatsby/src/internal-plugins/component-page-creator/gatsby-node.js b/packages/gatsby/src/internal-plugins/component-page-creator/gatsby-node.js index 5ea6e5d060353..9517a2a8de508 100644 --- a/packages/gatsby/src/internal-plugins/component-page-creator/gatsby-node.js +++ b/packages/gatsby/src/internal-plugins/component-page-creator/gatsby-node.js @@ -21,16 +21,17 @@ exports.createPagesStatefully = async ( ) => { const { createPage, deletePage } = boundActionCreators const program = store.getState().program - const pagesDirectory = systemPath.posix.join(program.directory, `/src/pages`) const exts = program.extensions.map(e => `${e.slice(1)}`).join(`,`) + const pagesDirectory = systemPath.posix.join(program.directory, `/src/pages`) + const pagesGlob = `${pagesDirectory}/**/*.{${exts}}` // Get initial list of files. - let files = await glob(`${pagesDirectory}/**/?(${exts})`) + let files = await glob(pagesGlob) files.forEach(file => _createPage(file, pagesDirectory, createPage)) // Listen for new component pages to be added or removed. chokidar - .watch(`${pagesDirectory}/**/*.{${exts}}`) + .watch(pagesGlob) .on(`add`, path => { if (!_.includes(files, path)) { _createPage(path, pagesDirectory, createPage)