【问题标题】:How to configure SASS to output shorthand hex colors如何配置 SASS 以输出速记十六进制颜色
【发布时间】:2012-11-19 09:52:29
【问题描述】:

有没有办法让 SASS 或 Compass 给你一个缩短的十六进制颜色?例如,如果我输入#444,它会在我的输出文件中给我#444444,这对我来说并不是真正的优化帮助。

【问题讨论】:

    标签: css configuration colors sass shorthand


    【解决方案1】:

    仅当输出样式设置为压缩时,颜色代码才会被优化。

    // style.scss
    $primary-color: #444;
    $secondary-color: #ffffff;
    .test {
      background: $primary-color;
      color: $secondary-color;
    }
    

    使用命令sass -t compressed style.scss style.css编译生成以下文件:

    // style.css
    .test{background:#444;color:#fff}
    

    【讨论】:

      猜你喜欢
      • 2020-05-17
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2011-02-27
      • 1970-01-01
      • 2011-01-27
      • 1970-01-01
      • 2014-08-19
      相关资源
      最近更新 更多