Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/javascript/429.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/html/80.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Javascript 在gatsby中导入后CSS类不工作_Javascript_Html_Css_Reactjs_Gatsby - Fatal编程技术网

Javascript 在gatsby中导入后CSS类不工作

Javascript 在gatsby中导入后CSS类不工作,javascript,html,css,reactjs,gatsby,Javascript,Html,Css,Reactjs,Gatsby,我导入了一个CSS文件,希望在其中使用CSS类。但是我的CSS类无法识别,也无法工作,但是我在同一个文件中直接针对HTML标记编写的CSS正在工作。我在用盖茨比 我的CSS `section{ width: 90vw; max-width: 1170px; text-transform: capitalize; margin: 0 auto; } .page { margin-left: 2rem; color: grey; } ` 我的

我导入了一个CSS文件,希望在其中使用CSS类。但是我的CSS类无法识别,也无法工作,但是我在同一个文件中直接针对HTML标记编写的CSS正在工作。我在用盖茨比

我的CSS

`section{
    width: 90vw;
    max-width: 1170px;
    text-transform: capitalize;
    margin: 0 auto;
}




.page {
    margin-left: 2rem;
    color: grey;
}
`
我的代码`

import styles from '../Components/products_module.css';
<section  >
               
<span className={styles.page}>{ * Some code *}</span>
                           
            </section>`

问题是在盖茨比中命名CSS文件。将文件名从
products\u module.css
更改为
products.module.css
。然后控制台记录它以查看您的所有样式:)

在CSS模块或某种类型的全局CSS中,CSS类是否不“工作”?
     plugins: [`gatsby-plugin-styled-components`   , `gatsby-transformer-sharp`, `gatsby-plugin-sharp` ,
  {
    resolve: `gatsby-source-filesystem`,
    options: {
      name: `images`,
      path: `${__dirname}/src/images/`,
    },
  
      resolve: `gatsby-source-contentful`,
      options: {
        spaceId: `ch9krotu7efpvpc`,
        // Learn about environment variables: https://gatsby.dev/env-vars
        accessToken: process.env.CONTENTFUL_ACCESSS_TOKEN,
      },},
  ],
}