Problem
I'm trying to produce some unicode characters after compiling my *.scss file.
As an example, I have the following (SCSS):
.element:after {
content: "\a0";
}
When the file is compiled, it outputs the following (CSS):
.element:after {
content: "\\a0";
}
Notice the extra unwanted backslash (\).
Attempted Solution #1
I did try the solution here: Sass: unicode escape is not preserved in .css file, which suggests introducing the following function:
@function unicode($str) {
@return unquote("\"")+unquote(str-insert($str, "\\", 1))+unquote("\"")
}
And using it like so (SCSS):
.element:after {
content: unicode("a0");
}
However, this produces the following (CSS)
.element:after {
content: "\\" ")+unquote(str-insert($str, " \\\\ ", 1))+unquote(" \\ "";
}
Notice, it's not even invoking the function as intended. Why is that?
Project Details
I'm using these libraries in Maven:
<dependency>
<groupId>net.jawr</groupId>
<artifactId>jawr-core</artifactId>
<version>3.9</version>
</dependency>
<dependency>
<groupId>net.jawr.extensions</groupId>
<artifactId>jawr-spring-extension</artifactId>
<version>3.9</version>
</dependency>
<dependency>
<groupId>com.darrinholst</groupId>
<artifactId>sass-java-gems</artifactId>
<version>3.4.20.0</version>
</dependency>
<dependency>
<groupId>org.jruby</groupId>
<artifactId>jruby-core</artifactId>
<version>9.1.5.0</version>
</dependency>
<dependency>
<groupId>org.jruby</groupId>
<artifactId>jruby-stdlib</artifactId>
<version>9.1.5.0</version>
</dependency>
Temporary solution
Don't use unicodes in SCSS. Instead, use Font Awesome in the HTML (keeping Font Awesome in a CSS file).