Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Unicode codepoints change between recompiles #304

Open
foca opened this issue Jan 26, 2016 · 3 comments
Open

Unicode codepoints change between recompiles #304

foca opened this issue Jan 26, 2016 · 3 comments

Comments

@foca
Copy link
Contributor

foca commented Jan 26, 2016

Whenever we add a new icon, the code points for other icons change, which breaks our CSS whenever we try to reference icons directly from the stylesheet (e.g. in a :before { content: "\f137"; } rule).

This is kind of annoying, as each new icon means we need to go over a lot of CSS rules to fix the references.

@srekoble
Copy link

srekoble commented May 15, 2017

Is there any solution to the above issue? When more than 1 developer are inserting or deleting icons fontcustom compiles all icons and delivers a huge diff instead of just the newly add/removed icons.

@kinnalru
Copy link

kinnalru commented Oct 6, 2017

You must not use codes directly. Try to use custom sass/less template to generate named mixins. Something like this fontcustom-rails.scss:

//
// Icon Font: <%= font_name %>
//

<%= font_face(url: "font-url", path: @font_path_alt ) %>

.<%= font_name %>-ic {
  <%= glyph_properties %>
}

<%= glyph_selectors.gsub(':before', '') %> {
  &:before {
    @extend .<%= font_name %>-ic;
  }
}


// var
<%=
@glyphs.inject([]) do |ret, p|
  name, value = p
  selector = @options[:css_selector].sub('{{glyph}}', name.to_s)
  content  = "\"\\#{value[:codepoint].to_s(16)}\""


  ret << "#{selector}-mixin { content: #{content} } ; "
  ret
end.map(&:strip).join("\n").strip
%>


// style
<%=
@glyphs.inject([]) do |ret, p|
  name, value = p
  selector = @options[:css_selector].sub('{{glyph}}', name.to_s)
  content  = "\"\\#{value[:codepoint].to_s(16)}\""

  ret << "#{selector} { &:before{ content: #{content} } }"
  ret
end.map(&:strip).join("\n").strip
%>

@magynhard
Copy link

According to #56 it is possible to keep the unicode for icons.

But I wonder where i can define these mappings of icons to unicode. Didn't find any example how to do it.

Can anyone help?

# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants