Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feature(gatsby): Extract non-css-in-js css and add add to <head> when SSRing in dev #28471

Merged
merged 44 commits into from
Jan 4, 2021
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
44 commits
Select commit Hold shift + click to select a range
ee315ed
feature(gatsby): Pause dev-ssr watching between page loads to avoid s…
KyleAMathews Dec 1, 2020
b94ced1
update snapshot
KyleAMathews Dec 1, 2020
0228936
Don't double-resolve + add activity for building the SSR bundle
KyleAMathews Dec 1, 2020
135e960
Merge remote-tracking branch 'origin/master' into lazy-compile
KyleAMathews Dec 1, 2020
b96c520
Add timeout for tests to ensure that dev server has time to bundle SS…
KyleAMathews Dec 1, 2020
fee4f5a
Merge remote-tracking branch 'origin/master' into lazy-compile
KyleAMathews Dec 1, 2020
36e7f9e
feature(gatsby): Extract and add CSS when SSRing in dev
KyleAMathews Dec 3, 2020
3357d79
Remove commented out code
KyleAMathews Dec 3, 2020
b3bb3b4
get tests passing
KyleAMathews Dec 4, 2020
64bc7f9
WIP
KyleAMathews Dec 4, 2020
8e5f6f0
Got hot-reloading working w/ mini-css-extract-plugin
KyleAMathews Dec 4, 2020
468a286
remove mistakenly added file
KyleAMathews Dec 4, 2020
410424c
remove change to yarn.lock
KyleAMathews Dec 4, 2020
d27291f
revert other mistakenly added files
KyleAMathews Dec 4, 2020
68b32ad
Add an async module to test against
KyleAMathews Dec 4, 2020
e6b4c39
fix async module
KyleAMathews Dec 4, 2020
9ecb314
Add postcss/tailwind
KyleAMathews Dec 4, 2020
84a4f2c
write webpack config for easy comparisons
KyleAMathews Dec 7, 2020
3e8fa67
that was a lot easier than I thought — just set hmr:true for non-prod…
KyleAMathews Dec 7, 2020
baf7a65
cleanups
KyleAMathews Dec 7, 2020
31354f2
Don't need this since we're using <link> not <style>
KyleAMathews Dec 7, 2020
92e4656
pass in port
KyleAMathews Dec 7, 2020
5a35154
remove dev css from test comparisons
KyleAMathews Dec 7, 2020
d4ae483
Update snapshots + add tailwind
KyleAMathews Dec 7, 2020
d4d5340
cleanups
KyleAMathews Dec 7, 2020
59148ae
remove discarded changes
KyleAMathews Dec 8, 2020
08ee647
Move changes behind flag
KyleAMathews Dec 8, 2020
c1eeff7
Undo unnecesary changes
KyleAMathews Dec 8, 2020
1f9fbdc
Update tests for signature change
KyleAMathews Dec 8, 2020
1125d6c
Move more code behind the flag
KyleAMathews Dec 8, 2020
51bbd3b
Merge branch 'lazy-compile' into mini-css-dev-ssr
KyleAMathews Dec 8, 2020
4fbb812
dynamically set absolute URL for css files so works wherever it's hosted
KyleAMathews Dec 8, 2020
e563bda
start relative than make absolute
KyleAMathews Dec 8, 2020
d59c6e2
Remove now unused port
KyleAMathews Dec 21, 2020
627239c
Remove changes from https://github.com/gatsbyjs/gatsby/pull/28394/
KyleAMathews Dec 21, 2020
1afed99
use @pieh's suggested refactor in https://github.com/gatsbyjs/gatsby/…
KyleAMathews Dec 21, 2020
3c088a5
pass naming options for extractText in via options
KyleAMathews Dec 21, 2020
139efda
Update packages/gatsby/src/utils/webpack.config.js
KyleAMathews Dec 22, 2020
6d3a64b
Update snapshot
KyleAMathews Dec 22, 2020
b1506c0
Stop Jest from chocking on import of css
KyleAMathews Dec 22, 2020
9c34498
turned out we didn't need this
KyleAMathews Dec 22, 2020
0b78528
test(ssr): ignore src/test file (those are not tests)
pieh Jan 4, 2021
a22361f
test(ssr): update snapshot after removing inline script modyfing href
pieh Jan 4, 2021
f01a5fd
Merge remote-tracking branch 'origin/master' into mini-css-dev-ssr
pieh Jan 4, 2021
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
cleanups
  • Loading branch information
KyleAMathews committed Dec 7, 2020
commit baf7a65b7e99dbb7d9765e9b3d4e61bdc93d84d0
3 changes: 0 additions & 3 deletions packages/gatsby-plugin-postcss/src/gatsby-node.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@ exports.onCreateWebpackConfig = (
const isSSR = stage.includes(`html`)
const config = getConfig()
const cssRules = findCssRules(config)
console.log(cssRules)

delete postcssLoaderOptions.plugins

Expand Down Expand Up @@ -51,8 +50,6 @@ exports.onCreateWebpackConfig = (
],
}

console.log(postcssLoader, postcssRule, postcssRuleModules)

if (!isSSR) {
postcssRule.use.unshift(loaders.miniCssExtract())
postcssRuleModules.use.unshift(loaders.miniCssExtract())
Expand Down
2 changes: 0 additions & 2 deletions packages/gatsby/src/services/start-webpack-server.ts
Original file line number Diff line number Diff line change
Expand Up @@ -126,11 +126,9 @@ export async function startWebpackServer({

// Download css assets
const cssAssets = statsToJson.assets.filter(asset => {
// console.log({ asset })
return asset.name.endsWith(`.css`)
})

console.log({ asset: cssAssets[0], port: program.port })
// Stream to public directory so we can access during SSR.
cssAssets.forEach(async asset => {
console.log(
Expand Down
10 changes: 0 additions & 10 deletions packages/gatsby/src/utils/webpack.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -231,7 +231,6 @@ module.exports = async (
plugins.extractStats(),
])
.filter(Boolean)
console.log(configPlugins)
break
case `build-javascript`: {
configPlugins = configPlugins.concat([
Expand Down Expand Up @@ -704,14 +703,5 @@ module.exports = async (
parentSpan,
})

require(`util`).inspect.defaultOptions.depth = null
console.log(
process.cwd() + `/webpack-config-${stage}-${new Date().toJSON()}.json`
)
fs.writeFileSync(
process.cwd() + `/webpack-config-${stage}-${new Date().toJSON()}.json`,
require(`util`).inspect(getConfig())
)

return getConfig()
}