Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

node-sass: Fontawesome icon encoding issues

Tags:

css

encoding

I'm using node-sass and gulp-sass to compile my assets.

Now when I'm running gulp with sass outputStyle: 'nested' (default), the fontawesome characters are changed from:

$fa-var-home: "\f015";

to

.fa-home:before {
  content: "";
}

Using this in the browser seems to be working fine.

When running sass with outputStyle: 'compressed', I'm getting different characters:

.fa-home:before{content:""}

Now the strange part: sometimes, but I don't have any steps to reproduce this, the characters are also shown just like that, so  instead of a home icon.

I can't put my fingers on it and in 99.99% of the cases it is just fine. But in some situations it goes wrong and I don't understand why!

like image 928
Timo002 Avatar asked Jul 24 '26 10:07

Timo002


1 Answers

recently I had the same situation. whenever you compile compiling using compressed outputStyle it's also removing charset: utf-8. For that reason you are getting that different characters.

So I'm using postcss-normalize-charset which basically add necessary charset keeping outputStyle compressed

like image 157
diegodafm Avatar answered Jul 28 '26 14:07

diegodafm



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!