Why does importing CSS modules in _document.js
not work?
#16726
Answered
by
jamesmosier
jensmeindertsma
asked this question in
Help
-
// styles.module.css
.link {
color: green;
} // _document.js
import styles from "../styles.module.css";
...
<body>
<a className={styles.link}>A link</a>
<Main />
<NextScript />
</body>
.... The styles are not applied to the element. It is given a scoped className, but this className doesn't contain the styles. Is this intended? |
Beta Was this translation helpful? Give feedback.
Answered by
jamesmosier
Aug 31, 2020
Replies: 1 comment 2 replies
-
Correct, these will not work in a custom Document per the docs. You should be able to relocate this logic to |
Beta Was this translation helpful? Give feedback.
2 replies
Answer selected by
jensmeindertsma
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Correct, these will not work in a custom Document per the docs.
You should be able to relocate this logic to
_app.js
and be able to use CSS modules there.