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.

Config option to Allow importing CSS from any file

See original GitHub issue

Feature request

Is your feature request related to a problem? Please describe.

I’m using Linaria with Next.js which generates unique hashes for each className so it is safe to import the generated CSS globally.

Currently importing global CSS is only allowed in _app.js.

Describe the solution you’d like

It would be great if we had the option to allow css files to be imported from any file with a configuration option in next.config.js:

module.exports = {
  css: {
    importAsGlobal: true
  }
}

Issue Analytics

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

github_iconTop GitHub Comments

3reactions
graglandcommented, Apr 25, 2020

If you use the next-css or next-sass plugins then it will automatically disable the new CSS handling and allow global imports.

3reactions
Pytalcommented, Feb 29, 2020

Yeah it’s pretty great when writing css modules or global stylesheets, although as linaria inserts css import statements into each file that imports linaria, and the built-in css support does not allow importing global css files into any file (only _app.js), linaria currently does not work with built-in css support.

Read more comments on GitHub >

github_iconTop Results From Across the Web

import - CSS: Cascading Style Sheets - MDN Web Docs
The @import CSS at-rule is used to import style rules from other valid stylesheets. An @import rule must be defined at the top...
Read more >
css-loader | webpack - JS.ORG
The option importLoaders allows you to configure how many loaders before css-loader should be applied to @import ed resources and CSS modules/ICSS imports....
Read more >
css module/ importing css files in tsx or ts files #146 - GitHub
I am trying to make css-modules and typescript to work together with webpack. So i have this file import * as styles from...
Read more >
How to configure CSS and CSS modules in webpack
Before we configure CSS support in the webpack setup, let's first add a CSS file and use it. The first thing we are...
Read more >
How to configure CSS Modules for webpack - LogRocket Blog
Let's begin by setting up webpack. Our demo app has an src folder containing index.html , style.css , and index.js . Outside the...
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