From 4803d610547ed12d55d07e2165f3ea4de822fbf2 Mon Sep 17 00:00:00 2001 From: brotzky Date: Tue, 3 Jul 2018 17:07:20 -0700 Subject: [PATCH 01/15] First try at cleaning up build output --- packages/gatsby/cache-dir/static-entry.js | 12 ++++++---- packages/gatsby/src/bootstrap/index.js | 2 ++ packages/gatsby/src/commands/build-html.js | 2 +- packages/gatsby/src/commands/develop-html.js | 2 +- packages/gatsby/src/utils/webpack.config.js | 25 ++++++++++---------- 5 files changed, 24 insertions(+), 19 deletions(-) diff --git a/packages/gatsby/cache-dir/static-entry.js b/packages/gatsby/cache-dir/static-entry.js index b677047053c28..4288573f4da5d 100644 --- a/packages/gatsby/cache-dir/static-entry.js +++ b/packages/gatsby/cache-dir/static-entry.js @@ -193,6 +193,7 @@ export default (pagePath, callback) => { const scripts = scriptsAndStyles.filter( script => script.name && script.name.endsWith(`.js`) ) + const styles = scriptsAndStyles.filter( style => style.name && style.name.endsWith(`.css`) ) @@ -221,7 +222,7 @@ export default (pagePath, callback) => { as="script" rel={script.rel} key={script.name} - href={urlJoin(pathPrefix, script.name)} + href={urlJoin(`scripts`, pathPrefix, script.name)} /> ) }) @@ -252,7 +253,7 @@ export default (pagePath, callback) => { as="style" rel={style.rel} key={style.name} - href={urlJoin(pathPrefix, style.name)} + href={urlJoin(`styles`, pathPrefix, style.name)} /> ) } else { @@ -262,7 +263,7 @@ export default (pagePath, callback) => { data-href={urlJoin(pathPrefix, style.name)} dangerouslySetInnerHTML={{ __html: fs.readFileSync( - join(process.cwd(), `public`, style.name), + join(process.cwd(), `public`, `styles`, style.name), `utf-8` ), }} @@ -291,7 +292,10 @@ export default (pagePath, callback) => { // Filter out prefetched bundles as adding them as a script tag // would force high priority fetching. const bodyScripts = scripts.filter(s => s.rel !== `prefetch`).map(s => { - const scriptPath = `${pathPrefix}${JSON.stringify(s.name).slice(1, -1)}` + const scriptPath = `/scripts${pathPrefix}${JSON.stringify(s.name).slice( + 1, + -1 + )}` return