L
L
Larisa2018-02-08 12:59:22
css
Larisa, 2018-02-08 12:59:22

How to solve the problem of sсss compiling content:''?

@mixin fontello( $code ) {
  &:before {
    content: '\e#{$code}';
  }
}


.icon-star {
  @include fontello(800);
}

after compilation it turns out nonsense in
.icon-star:before {
  content: "хрень800";
}

If you try
@mixin fontello( $code ) {
  &:before {
    content: '#{$code}';
  }
}
после компеляции получается  лишний слеш
.icon-star {
  @include fontello(\e800);
}

.icon-star:before {
  content: "\\e800";
}

Answer the question

In order to leave comments, you need to log in

1 answer(s)
M
Maxim, 2018-02-08
@ghostr1der

@function unicode($str) {
    @if (str-slice($str, 1, 1) != str-slice("\\", 1, 1)) {
        $str: unquote(str-insert($str, str-slice("\\", 1, 1), 1));
    }
    @return unquote("\"")+$str+unquote("\"")
} 


.icon-star {
  content: unicode(e800);
}

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question