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.

How to import bulma css globally with cssModules enabled

See original GitHub issue

I’m trying to start a project in Next.js that uses CSS modules and bulma.io globally.

My next.config.js is this:

const withSass = require('@zeit/next-sass')

module.exports = withSass({
  cssModules: true,
  webpack: config => {
    // Fixes npm packages that depend on `fs` module
    config.node = {
      fs: 'empty'
    }

    return config
  }
})

I’ve a styles.scss imported in my component that is this:

:global {
  @import '~bulma/bulma';
}

but when compiling I get the following error:

./stylesheets/styles.scss
Missing whitespace before :global (9:2)

   7 |     transform: rotate(0deg); }
   8 |   to {
>  9 |     transform: rotate(359deg); } }
     |  ^
  10 |   :global .delete, :global .modal-close, :global .is-unselectable, :global .button, :global .file, :global .breadcrumb, :global .pagination-previous,
  11 |   :global .pagination-next,
  12 |   :global .pagination-link,

How can I use CSS modules but use bulma.io globally?

Issue Analytics

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

github_iconTop GitHub Comments

1reaction
timneutkenscommented, Feb 12, 2020

Adding next-sass will disable built-in support, so you have to remove https://github.com/pioz/next-sample/blob/master/next.config.js#L1-L4

0reactions
balazsorban44commented, Jan 30, 2022

This issue has been automatically locked due to no recent activity. If you are running into a similar issue, please create a new issue with the steps to reproduce. Thank you.

Read more comments on GitHub >

github_iconTop Results From Across the Web

With node-sass | Bulma: Free, open source, and modern CSS ...
To build a CSS file from a Sass file, we can use node scripts. In package.json , add the ... node_modules/bulma/sass/utilities/_all.sass"; @import "....
Read more >
Importing external stylesheets globally with CSS modules
I have installed node-sass and successfully added a .scss file to one of my components. External (Bulma) styles are added via @import "~bulma/ ......
Read more >
A deep dive into CSS Module - LogRocket Blog
Note: Although CSS Module enables us to scope our styles, we can still declare global classes by prefixing the class name with :global:....
Read more >
Styles & CSS - Astro Documentation
.jsx files support both global CSS and CSS Modules. To enable the latter, use the .module.css extension (or .module ...
Read more >
Adding Bulma CSS to your React application | Sanity.io guide
Create a style.scss file in your src folder and insert the following code to import Bulma. @charset "utf-8"; ...
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