jossef / material-design-icons-iconfont

Material Design icons + Development Experience
https://jossef.github.io/material-design-icons-iconfont
Apache License 2.0
455 stars 58 forks source link

Why CSS classes appending :before with content? #53

Closed isevcik closed 2 years ago

isevcik commented 4 years ago

The style definition also defines compound classes like .material-icons.done which applies :before with content : containing glyph code for the related icon. This is unlike the original google/material-design-icons repo and could cause errors like duplicated icons (if you apply classes like .done for <i> for your own purposes). The documentation or README says nothing about this divergence.

flmuel commented 4 years ago

There is a bug, when using the "material-icons-content" function. The function does not map the name to the font code. But the material-icon mixin uses this function too for "unquoting", so you have to edit both:

@mixin material-icon($name, $pseudo: 'before') {
  $codepoint: map-get($material-icons-codepoints, $name);

  &::#{$pseudo} {
    content: unquote('"\\#{$codepoint}"');
  }
}

@function material-icons-content($codepoint) {
  @return unquote('"\\#{map-get($material-icons-codepoints, $codepoint)}"');
}