Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Sass: unicode escape is not preserved in .css file [duplicate]

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?

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 */
like image 441
Michiel Borkent Avatar asked May 24 '15 08:05

Michiel Borkent


1 Answers

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")

Output:

.icon-ok:before {
  content: "\e601";
}
like image 169
sobolevn Avatar answered Sep 29 '22 10:09

sobolevn