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

fix(static-site): remove gatsby-inlined-css #108

Merged
merged 1 commit into from
Jan 30, 2020
Merged

fix(static-site): remove gatsby-inlined-css #108

merged 1 commit into from
Jan 30, 2020

Conversation

ivan-aksamentov
Copy link
Member

Since Gatsby v2 CSS is inlined automagically and the explicit setup relying on existence of public/styles.css (previously containing a portion of styles to be inlined) is no longer necessary, and, even worse, fails the production build with an error:

Cannot find module '!raw-loader!../public/styles.css'.

because public/styles.css is no longer provided by Gatsby v2.

This PR removes the explicit setup and resolves the error. Complements #75. Resolves #104.

See discussion in:

Relevant gatsby docs:

Since Gatsby v2  CSS is inlined automagically and the explicit setup relying on existence of `public/styles.css` (previously containing a portion of styles to be inlined) is no longer necessary, and even worse, fails the production build with an error: 

   > Cannot find module '!raw-loader!../public/styles.css'.

This removes the explicit setup and resolves the error.

See discussion in:
 - #104
 - #75 (comment)
Relevant gatsby docs:
 - https://www.gatsbyjs.org/docs/migrating-from-v1-to-v2/#remove-inlined-css-in-htmljs

Resolves #104
@ivan-aksamentov
Copy link
Member Author

ivan-aksamentov commented Jan 30, 2020

It is recommended to clear Gatsby's cache in static-site/.cache in order for changes to be picked up:

   rm -rf static-site/.cache

or, if you have gastby-cli installed:

   cd static-site
   gastby clean

@jameshadfield jameshadfield temporarily deployed to nextstrain-s-fix-remove-8wu7rj January 30, 2020 22:30 Inactive
@jameshadfield
Copy link
Member

Tested via https://nextstrain-s-fix-remove-8wu7rj.herokuapp.com/ & all looks good. Thanks @ivan-aksamentov 👍

and, even worse, fails the production build with an error:

Sort-of -- the error log was printed from a catch block & didn't cause the built to fail. Much cleaner to have this all removed 😄

@jameshadfield jameshadfield merged commit 53e5e9d into nextstrain:master Jan 30, 2020
@ivan-aksamentov ivan-aksamentov deleted the fix/remove-explicit-inline-css branch February 2, 2020 01:29
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Build error: Cannot find module '!raw-loader!../public/styles.css'
2 participants