I have a styles
folder in my app and it contains a file named Home.module.css
.
But whenever I add this code in my pages/index.js
, i get an error, the error is always the same, 404 page not found..
import styles from '../styles/Home.module.css'
Please help me get out of this problem.
Following documentation you should just import styles without naming it:
import '.../styles/Home.module.css'
But, if you want to use varibales you can install SASS and import your styles by name:
import variables from '../styles/variables.module.scss'
export default function MyApp({ Component, pageProps }) {
return (
<Layout color={variables.primaryColor}>
<Component {...pageProps} />
</Layout>
)
}
NOTE: pay attention to extension. If you are using SASS the extension of file should be SCSS .
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.