【问题标题】:I make some changes in css of react-nice-ticker package but when i deploy code then all my changes override我对 react-nice-ticker 包的 css 进行了一些更改,但是当我部署代码时,我的所有更改都会覆盖
【发布时间】:2020-10-27 08:48:44
【问题描述】:

这是我的 style.css

.styles_ticker__8iZE9 {
    background-color: rgb(56, 55, 63);
    width: 100%;
    overflow: hidden;
    margin-top: -40px;
    margin-left: -10px;
    padding-bottom: 8px;
    border-bottom: 1px solid #26A69A;
    
}
.styles_tickerItemFinancial__3uuXj:hover {
    background-color: rgb(56, 55, 63);
    cursor: pointer;

}
.newsticker{
    position: fixed;
    left: 0;
    bottom: 0;
    width: 100%;

}

a:hover{
    text-decoration: none;
}

.styles_newsticker__2xlP7 {
    min-width: 27%;
    padding: 0.6rem;
    color: #26A69A;
    display: flex;
    align-items: center;
    font-size: 13px;
    font-weight: 500;
    text-decoration: none;
    border-top: 1px solid #26A69A;

}
.styles_newsticker__2xlP7:hover {
    background-color: rgb(56, 55, 63);
}

.styles_title__24Ef9:hover , .styles_newsticker__2xlP7:hover {
    text-decoration: none;
    color: #ffffff;
}

.styles_tickerItem__1yblE:after {
    background: #26A69A;
    content: "";
    position: absolute;
    top: 10px;
    bottom: 10px;
    left: -1px;
    width: 2px;
}

.styles_meta__2enVD {
    font-size: 12px;
    color: #fff;
    opacity: 1;
}


这是我的 .js 文件
这是我的 react 组件,我在其中实现了一个不错的 react 代码包。

import Ticker, { FinancialTicker, NewsTicker } from 'nice-react-ticker';
import axios from 'axios'
import './TickerList.style.css'
    render() {
        return (
          <div>      
              <Ticker style={{paddingBottom :"50px"}}>
                 {
                 this.state.tickerData.map(buc => (
                   <FinancialTicker id={buc.id} change={true} symbol={buc[1]} lastPrice={buc[3]} percentage={buc[2]} />
                  ))
                }
              </Ticker>   
          </div>

        )
    }
}

当我在 AWS 上部署我的代码时,包的预样式会覆盖我的样式 但在本地一切正常(我的更改不会被预样式覆盖) 如何停止预样式以覆盖我的本地样式

【问题讨论】:

    标签: css reactjs react-native sass react-redux


    【解决方案1】:

    是的,您的更改仅适用于本地,当您部署到 AWS 时,它将安装新包,因为您尚未对其进行编辑,您的本地更改不会影响。

    看看Patch-package。它将帮助您在 npm install 之后自动修复依赖项中的错误。或者简单地创建一个 bash 脚本,它将正则表达式并替换您想要的文件并将其放入 package.json 中脚本的postinstall

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2016-10-25
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2021-04-25
      • 1970-01-01
      • 2021-06-16
      相关资源
      最近更新 更多