I've encountered two CSS-related oddities that occur when using gatsby develop and not gatsby build. This seems to be (partly) related to #9911 but that issue remains closed so I'm re-reporting the problems here.
Problem 1: a page displayed under gatsby develop shows a bootstrap spinner but, under gatsby build, it does not.
Problem 2: a page displayed under gatsby develop changes colours when a completely unrelated line in a completely unrelated file is commented out & the file saved.
Both problems can be reproduced with https://github.com/pcolmer/gatsby-bug-poc. After cloning the repo, you need to mkdir src/markdownpages as the directory is missing from the repo and I can't get it added to the repo.
Problem 1:
gatsby developgatsby buildgatsby serve -p 8000Repeat steps 2 & 3. Step 2 should look the same. For step 3, you should see the text "Loading..." in the top left corner of the page, because the bootstrap CSS isn't getting loaded.
Problem 2:
gatsby developNotice that I've added a nav bar and that the background is blue.
Open components/loading.js, comment out line 2 (import "../styles/minimal.scss") and save it. Gatsby rebuilds the site ... and the nav bar's background changes to green, which is the colour it should be.
For problem 1, the spinner should never be displayed because the page is not loading the bootstrap CSS. The branch possible-fix applies a CSS change to the test page to correct that error. However, the fact that the spinner displays under gatsby develop misleads the developer into thinking that everything is OK.
For problem 2, the banner should be green.
For problem 1, the spinner is displayed during gatsby develop but not during gatsby build/gatsby serve
For problem 2, the banner is blue until a CSS-related line in an unrelated file is commented out.
System:
OS: Linux 4.19 Ubuntu 20.04.1 LTS (Focal Fossa)
CPU: (4) x64 Intel(R) Core(TM) i5-6300U CPU @ 2.40GHz
Shell: 5.0.17 - /bin/bash
Binaries:
Node: 12.18.1 - ~/.nvm/versions/node/v12.18.1/bin/node
npm: 6.14.7 - ~/.nvm/versions/node/v12.18.1/bin/npm
Languages:
Python: 3.8.2 - /usr/bin/python
npmPackages:
gatsby: ^2.24.47 => 2.24.47
gatsby-cli: ^2.12.87 => 2.12.87
gatsby-plugin-react-helmet: ^3.3.10 => 3.3.10
gatsby-plugin-react-helmet-canonical-urls: ^1.4.0 => 1.4.0
gatsby-plugin-sass: ^2.3.12 => 2.3.12
gatsby-source-filesystem: ^2.3.19 => 2.3.24
gatsby-transformer-remark: ^2.8.25 => 2.8.28
npmGlobalPackages:
gatsby-cli: 2.12.84
I've done some further digging into this ... the problem where the spinner appears in develop but not in build seems to be down to the retrieval of blob:http://localhost:8000/1083e78e-a3fd-43c4-86dc-3f57e39fa4d1 which seems to be a mega-CSS bundle provided by gatsby develop, and it includes the bootstrap CSS even though the test page isn't retrieving it.
With the colour changing problem, there are two blobs getting pulled in and the second blob is the one that defines the blue colour instead of the green colour. greping the code for the colour references shows that the green (correct) colour is defined in src/styles/theme.scss while the blue (incorrect) colour is defined in node_modules/bootstrap/dist/css/bootstrap.css confirming that, again, gatsby develop appears to be pulling in all CSS files it can find, even if they aren't referenced.
Hiya!
This issue has gone quiet. Spooky quiet. 馃懟
We get a lot of issues, so we currently close issues after 60 days of inactivity. It鈥檚 been at least 20 days since the last update here.
If we missed this issue or if you want to keep it open, please reply here.
As a friendly reminder: the best way to see this issue, or any other, fixed is to open a Pull Request. Check out gatsby.dev/contribute for more information about opening PRs, triaging issues, and contributing!
Thanks for being a part of the Gatsby community! 馃挭馃挏
I definitely do want to keep this open until it is resolved.
I've created clear repro steps that show distinct differences in the behaviour between gatsby develop and gatsby build and it is very frustrating that there are these differences. It makes it really hard to figure out what to do to fix this when, ultimately, gatsby itself is getting in my way.
In my case, gatsby-plugin-minify was making this problem, which led the production build to reload all styles after a page was loaded completely in the production build.
Hiya!
This issue has gone quiet. Spooky quiet. 馃懟
We get a lot of issues, so we currently close issues after 60 days of inactivity. It鈥檚 been at least 20 days since the last update here.
If we missed this issue or if you want to keep it open, please reply here.
As a friendly reminder: the best way to see this issue, or any other, fixed is to open a Pull Request. Check out gatsby.dev/contribute for more information about opening PRs, triaging issues, and contributing!
Thanks for being a part of the Gatsby community! 馃挭馃挏
Time for a copy/paste of my reply from September 6th.
I definitely do want to keep this open until it is resolved.
I've created clear repro steps that show distinct differences in the behaviour between gatsby develop and gatsby build and it is very frustrating that there are these differences. It makes it really hard to figure out what to do to fix this when, ultimately, gatsby itself is getting in my way.
Just a heads-up to the Gatsby team: I have no intention of letting this issue die through inactivity. I've taken the time and trouble to provide a simple reproduction of the problem. The problem is clearly within Gatsby itself.
THIS NEEDS FIXING!
similar issue as @pcolmer
Hiya!
This issue has gone quiet. Spooky quiet. 馃懟
We get a lot of issues, so we currently close issues after 60 days of inactivity. It鈥檚 been at least 20 days since the last update here.
If we missed this issue or if you want to keep it open, please reply here.
As a friendly reminder: the best way to see this issue, or any other, fixed is to open a Pull Request. Check out gatsby.dev/contribute for more information about opening PRs, triaging issues, and contributing!
Thanks for being a part of the Gatsby community! 馃挭馃挏
So doesn't the Gatsby team care about issues with clear reproduction steps?
Is nobody on the team even looking at this?
Hiya!
This issue has gone quiet. Spooky quiet. 馃懟
We get a lot of issues, so we currently close issues after 60 days of inactivity. It鈥檚 been at least 20 days since the last update here.
If we missed this issue or if you want to keep it open, please reply here.
As a friendly reminder: the best way to see this issue, or any other, fixed is to open a Pull Request. Check out gatsby.dev/contribute for more information about opening PRs, triaging issues, and contributing!
Thanks for being a part of the Gatsby community! 馃挭馃挏
Please keep open 馃槍
Hiya!
This issue has gone quiet. Spooky quiet. 馃懟
We get a lot of issues, so we currently close issues after 60 days of inactivity. It鈥檚 been at least 20 days since the last update here.
If we missed this issue or if you want to keep it open, please reply here.
As a friendly reminder: the best way to see this issue, or any other, fixed is to open a Pull Request. Check out gatsby.dev/contribute for more information about opening PRs, triaging issues, and contributing!
Thanks for being a part of the Gatsby community! 馃挭馃挏
I'm still here, waiting for someone from the Gatsby team to chime in ...
@pcolmer I was having the same issue. I wasn't using the gatsby-browser.js file. Creating that file and importing my css solved the issue for me.
@ventocis thank you for the suggestion, but the POC repo does have that file in it:
https://github.com/pcolmer/gatsby-bug-poc/blob/master/gatsby-browser.js
My concern is that I don't understand why gatsby is behaving differently between the development and build phases of a project.
Sorry I should have checked that. Very good point about the inconsistency
Most helpful comment
Just a heads-up to the Gatsby team: I have no intention of letting this issue die through inactivity. I've taken the time and trouble to provide a simple reproduction of the problem. The problem is clearly within Gatsby itself.
THIS NEEDS FIXING!