English 中文(简体)
利用React中进口的CSS文档对CSS风格的无效财产价值
原标题:Invalid property value on CSS style using an imported CSS file in React

我试图打造一个反应部分。 为了做到这一点,我正在进口一个特别安全局的文件,并使用statName,如React文件所示。

我在我的web Pack.conf.js上添加了一台单体载荷+风格载荷。 档案如下:

const path = require( path )
const HtmlWebpackPlugin = require( html-webpack-plugin );

module.exports = {
  mode: "development",
  entry: "../src/index.js",
  output: {
    path: path.resolve(__dirname, "../dist"),
    filename: "bundle.js",
  },
  devtool:  inline-source-map ,
  devServer: {
    contentBase:  ../dist ,
    port: 8080
  },
  module: {
    rules: [
      {
        test: /.js$/,
        exclude: /(node_modules|bower_components)/,
        use: {
          loader:  babel-loader ,
          options: {
            presets: [ @babel/preset-env ,  @babel/preset-react ]
          }
        }
      },
      {
        test: /.css$/,
        use: [  style-loader ,  css-loader  ]
      }
    ]
  },
  plugins: [new HtmlWebpackPlugin(
    {template:  ../src/index.html }
  )]
}

页: 1 反应部分:

import React, {Component} from "react"
import "./App.css"

const App = () => (
  <div className="hello-world">Hello World</div>
)

export default App

我的App.css文档:

.hello-world{
  color: "#272C35"
}

由于房地产加价出现在开发工具中,因此,我的核心要素被正确地装上。 但出于某种原因,价值被标为不正确:

Capture of navigator inspect mode with incorrect css value

最佳回答

你不需要在CSS档案中引述六dec英的彩色价值。

问题回答

The same happened here, because I was writing CSS under MUI (Material UI) on directly on the componentes, and forgot about the unnecessary quotes.





相关问题
selected text in iframe

How to get a selected text inside a iframe. I my page i m having a iframe which is editable true. So how can i get the selected text in that iframe.

How to fire event handlers on the link using javascript

I would like to click a link in my page using javascript. I would like to Fire event handlers on the link without navigating. How can this be done? This has to work both in firefox and Internet ...

How to Add script codes before the </body> tag ASP.NET

Heres the problem, In Masterpage, the google analytics code were pasted before the end of body tag. In ASPX page, I need to generate a script (google addItem tracker) using codebehind ClientScript ...

Clipboard access using Javascript - sans Flash?

Is there a reliable way to access the client machine s clipboard using Javascript? I continue to run into permissions issues when attempting to do this. How does Google Docs do this? Do they use ...

javascript debugging question

I have a large javascript which I didn t write but I need to use it and I m slowely going trough it trying to figure out what does it do and how, I m using alert to print out what it does but now I ...

Parsing date like twitter

I ve made a little forum and I want parse the date on newest posts like twitter, you know "posted 40 minutes ago ","posted 1 hour ago"... What s the best way ? Thanx.

热门标签