仅在生产模式下具有CSS和URL背景图像的角度缩小

问题描述 投票:0回答:1

使用Angular 6和CLI模板,在css中具有渐变的图像背景。在开发模式下,它可以正常工作,但是当我执行prod版本(ng build“ --prod”)时,css将转换为无效的语法。

这里是scss文件:

.home-content {
  .mountain-header {
    margin: 0 auto;
    color: #fff;
    padding: 30px 10px;
    min-height: 110px;
    background: linear-gradient(180deg, rgba(0, 174, 199, .8) 0%, rgba(35,97,146,.8) 100%), url("https://cdnsite/background2.jpg") no-repeat !important;
    background-size: cover !important;
    background-position: center !important;
}

但是无论何时缩小,背景属性都将转换为此:

background: linear-gradient(180deg,rgba(0,174,199,.8) 0,rgba(35,97,146,.8) 100%) center!important/cover!important,url(https://cdnsite/background2.jpg) center!important/cover!important no-repeat!important!important!important

当我拿出url时,似乎可以在prod模式下工作(我得到了background-size和background-position)。就像当我在后台属性中包含Url时,它合并了3个属性。

css angular angular-cli-v6
1个回答
0
投票

由于某种原因,如果我删除了背景属性中的!important,似乎可以解决此问题...

© www.soinside.com 2019 - 2024. All rights reserved.