question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

gatsby-plugin-sass styles loaded as global css not as variable

See original GitHub issue

here for reproduce i’m using plugin gatsby-plugin-sass

create a file with name mystyles.scss the code import styles from ‘./mystyles.scss’

console.log(styles)

result

{ }

case two in mystyles.scss create a styles

.mybutton{
backgroud:red
}

the code

import styles from './mystyles.scss'

<button className="mybutton" />

i think this a bug

mystyles.scss is loaded as global styles, background color of button with class mybutton is red,

expect no backgroud because styles as variable no imported as global like import './mystyles.scss'

here an example styles as variable

import styles from './mystyles.scss'

<button className={styles.mybutton} />

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Comments:6 (2 by maintainers)

github_iconTop GitHub Comments

1reaction
deritcommented, Aug 9, 2019

@xBau follow this document https://www.gatsbyjs.org/packages/gatsby-plugin-sass/ and follow this https://www.gatsbyjs.org/packages/gatsby-plugin-sass/#with-css-modules

0reactions
baticodescommented, Aug 9, 2019

@derit how did you solve the problem?

I’m having the same issue

Read more comments on GitHub >

github_iconTop Results From Across the Web

Include sass in gatsby globally - Stack Overflow
Only do this with Sass files that contain just variables, mixins, functions, etc (Sass features that do not output any actual CSS until...
Read more >
gatsby-plugin-sass
gatsby-plugin-sass Provides drop-in support for Sass/SCSS stylesheets Install ... environmental variables (as Sass variables) or even prepend a global Sass ...
Read more >
Styling Gatsby Site with CSS - Ibaslogic
Styling Gatsby Site with CSS Modules. In order to add some sort of global styles in our Gatsby site, we added a stylesheet...
Read more >
CSS Modules + Sass Setup for Gatsby - Mediacurrent
CSS Modules provides a familiar approach to working with Sass -- even if you're not well-versed in Gatsby. Here's how to get started....
Read more >
Adding Bulma CSS to your React application | Sanity.io guide
Bulma resets browser styles and exclusively styles based on CSS classes, meaning the HTML you compose has no effect on the styling of...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found