Sass:.css文件中未保留Unicode转义 [英] Sass: unicode escape is not preserved in .css file

查看:213
本文介绍了Sass:.css文件中未保留Unicode转义的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

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

I am using a unicode escape in my .sass file and I want to preserve it, but sass is creating a weird character in the output. How to solve this?

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

I'm using a Mac and Sass version 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 */

推荐答案

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

It is known issue. There is a workaround, which can be found in the @tjbenton post on github:

@charset "UTF-8"

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

.icon-ok
  &:before
    content: unicode("e601")

输出:

.icon-ok:before {
  content: "\e601";
}

这篇关于Sass:.css文件中未保留Unicode转义的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆