Sass:.css文件中不保留unicode转义

Mic*_*ent 8 css unicode macos sass

我在.sass文件中使用unicode转义,我想保留它,但是sass在输出中创建了一个奇怪的字符.怎么解决这个?

我正在使用Mac和Sass版本3.4.13.

mborkent@MacBook-Pro-van-Michiel /tmp $ cat new.sass
.icon-ok
  &:before
    content: "\e601"
mborkent@MacBook-Pro-van-Michiel /tmp $ sass new.sass new.css
mborkent@MacBook-Pro-van-Michiel /tmp $ cat new.css
@charset "UTF-8";
.icon-ok:before {
  content: "?"; }

/*# sourceMappingURL=new.css.map */
Run Code Online (Sandbox Code Playgroud)

sob*_*evn 16

这是众所周知的问题.有一个解决方法,可以在github上的@tjbenton帖子中找到:

@charset "UTF-8"

@function unicode($str)
  @return unquote("\"")+unquote(str-insert($str, "\\", 1))+unquote("\"")

.icon-ok
  &:before
    content: unicode("e601")
Run Code Online (Sandbox Code Playgroud)

输出:

.icon-ok:before {
  content: "\e601";
}
Run Code Online (Sandbox Code Playgroud)