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.

sass-loader can't resolve :global or :local on css-module on .sass extension

See original GitHub issue

:global and :local isn’t working with sass-loader with .sass extension I tried to switch to less and stylus loader and it works perfectly. Not sure this is my fault in configuration ? or just sass syntax doesn’t allow :global and :local

screen shot 2017-05-08 at 2 40 31 am screen shot 2017-05-08 at 2 40 46 am
  {
    test: /\.sass$/,
    use: [{
      loader: 'style-loader'
    }, {
      loader: 'css-loader',
      options: {
        modules: true,
        localIdentName: '[name]-[local]-[hash:base64]'
      }
    },
    {
      loader: 'postcss-loader'
    }, {
      loader: 'sass-loader'
    }]
  },

SOLUTION: If anyone get this problem, /:global will fix the problem.

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Reactions:5
  • Comments:17 (7 by maintainers)

github_iconTop GitHub Comments

44reactions
o-alexandrovcommented, Aug 6, 2017

escaping is possible using \:global not /:global

6reactions
jpapcommented, Oct 19, 2017

@thomashibbard what worked for me was something like:

:global(.nestedClassParent) {
   color: blue;
}
:global(.nestedClassChild) {
   color: red;
}
Read more comments on GitHub >

github_iconTop Results From Across the Web

Can't import CSS/SCSS modules. TypeScript says "Cannot ...
In a webpack configuration that pipes *.scss files through sass-loader → css-loader → style-loader, there will be no content in the imported module, ......
Read more >
sass-loader - webpack - JS.ORG
The sass-loader uses Sass's custom importer feature to pass all queries to the Webpack resolving engine. Thus you can import your Sass modules...
Read more >
How to Use Sass with CSS Modules in Next.js - freeCodeCamp
Next.js gives us CSS Modules by default, providing benefits like scoped styles ... Step 4: Using Sass mixins with global imports in Next.js....
Read more >
Sass: @import
Sass extends CSS's @import rule with the ability to import Sass and CSS stylesheets, providing access to mixins, functions, and variables and combining ......
Read more >
Configuration - Nuxt
You will still need to install the required loader if you need to use them. Style Extensions. You can omit the file extension...
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