Config option to Allow importing CSS from any file
See original GitHub issueFeature 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:
- Created 4 years ago
- Reactions:13
- Comments:6 (2 by maintainers)
Top 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 >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found

If you use the
next-cssornext-sassplugins then it will automatically disable the new CSS handling and allow global imports.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.