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

Each transpiled file includes its own copy of styles instead of a static reference #366

Closed
TomNUSDS opened this issue Jul 15, 2021 · 4 comments
Labels

Comments

@TomNUSDS
Copy link
Contributor

Describe the bug
There is something wrong with our build. CSS styles should be referenced in an external css file not embedded in each file. This is making the file very large.

To Reproduce
Steps to reproduce the behavior:

  1. run gatsby clean
  2. run gatsby build
  3. optional run prettier --write ./public/ to reformat "compressed" content.
  4. Open any of the index.html files
    Result: each file has 21k lines of css in it.

Expected behavior
The css should be referenced via a external file. eg. <link type="text/css" rel="stylesheet" href="...">

@TomNUSDS TomNUSDS added P3 bug Priority 3 bug needs-triage labels Jul 15, 2021
@TomNUSDS
Copy link
Contributor Author

TomNUSDS added a commit that referenced this issue Jul 15, 2021
Fix for issue #366

SSR means "server side rendering". This fix is from a long github discussion about how broken including all css inline in the file is. (Especially since newer CSP guidelines say all css should be in a separate file.)
TomNUSDS added a commit that referenced this issue Jul 17, 2021
Fix for issue #366
* Create gatsby-ssr.js
Note: SSR means "server side rendering". This fix is from a long github discussion about how broken including all css inline in the file is. (Especially since newer CSP guidelines say all css should be in a separate file.)

* PR code review fixes
* Check el.props['data-href'] is valid
* Add comment for production only.
@katherinedm-usds
Copy link
Contributor

hi @TomNUSDS! I see this is in Design column. Not sure from this bug description and history if this specifically needs Design input right now, and if so what that input is?

@TomNUSDS
Copy link
Contributor Author

TomNUSDS commented Jul 20, 2021

This was purely an dev issue. It was just a bit inefficient in generating the html/css.

@switzersc-usds switzersc-usds changed the title Each transpiled file includes it's own copy of styles instead of a static reference Each transpiled file includes its own copy of styles instead of a static reference Jul 27, 2021
@switzersc-usds
Copy link
Contributor

Fixed!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants