Skip to content
This repository has been archived by the owner on Mar 10, 2024. It is now read-only.

Use of buggy plugin gatsby-plugin-styled-jsx-postcss #110

Open
edmcman opened this issue May 15, 2020 · 2 comments
Open

Use of buggy plugin gatsby-plugin-styled-jsx-postcss #110

edmcman opened this issue May 15, 2020 · 2 comments

Comments

@edmcman
Copy link

edmcman commented May 15, 2020

This project is using gatsby-plugin-styled-jsx-postcss which is known to cause lockups in some versions of nodejs and gatsbyjs. For more information please see this issue: gatsbyjs/gatsby#21885

My website is based on this starter (thanks! it's great) and I have experienced this first-hand when upgrading package versions. I personally switched to sass.

@lucaskjaero
Copy link

Hi @edmcman, I'm in a similar situation. Do you have some pointers on how to switch to sass? I've gotten rid of most of the postcss plugins, but am stuck on media queries and nesting.

@edmcman
Copy link
Author

edmcman commented Oct 14, 2021

@lucaskjaero Sass supports nesting out of the box. I don't remember any issues with media queries.

diff --git a/gatsby-config.js b/gatsby-config.js
index a30d21e..cfb5c1a 100644
--- a/gatsby-config.js
+++ b/gatsby-config.js
@@ -59,9 +59,14 @@ module.exports = {
     // Add typescript stack into webpack
     `gatsby-plugin-typescript`,
 
-    // Use styled jsx and PostCSS
+    // Use styled jsx and sass
+    {
+      resolve: `gatsby-plugin-styled-jsx`,
+      options: {
+        jsxPlugins: ['styled-jsx-plugin-sass']
+      }
+    },
     `gatsby-plugin-styled-jsx`, // The plugin's code is inserted directly to gatsby-node.js and gatsby-ssr.js files
-    `gatsby-plugin-styled-jsx-postcss`, // As above

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

No branches or pull requests

2 participants