小编Ho *_*Van的帖子

构建 Reacjs 项目后不透明度值更改为 1%

我正在构建一个 Reactjs 项目并使用 scss 而不是 css。在 App.scss 文件中,我设置了不透明度:87%;(注:单位为百分比)。

当我运行命令时,一切正常(不透明度值仍然等于 87%):yarn start

但是当我运行命令:yarn build 并检查文件 build/static/css/main.86352307.chunk.css 中的值不透明度时,不透明度值更改为 1%。

文件 App.scss:

.App {
  text-align: center;
  opacity: 87%;
}
Run Code Online (Sandbox Code Playgroud)

构建项目后:文件 build/static/css/main.86352307.chunk.css

.App{text-align:center;opacity:1%}
/*# sourceMappingURL=main.86352307.chunk.css.map */
Run Code Online (Sandbox Code Playgroud)

重现问题的步骤

#1. npx create-react-app my-app
#2. cd my-app
#3. yarn add node-sass
#4. rename file App.css to App.scss and then add opacity: 87% in class .App

#Testcase 1: run yarn start => the opacity value (87%) is apply for class .App
#Testcase 2: run yarn build => the …
Run Code Online (Sandbox Code Playgroud)

reactjs node-sass

41
推荐指数
2
解决办法
5768
查看次数

标签 统计

node-sass ×1

reactjs ×1