-
Notifications
You must be signed in to change notification settings - Fork 73
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Preserve order when updating font #54
Comments
I realized it too late as it went to prod 😩 then I was keeping the file names prefix as zz1, zz2.... to get the new files to the end but later realized after zz9 it takes zz10 before zz1 😡 like a weird dictionary then I had to name it Zzz1a zzz1b now the classnames are a mess. I couldn't do anything as it all went to prod and uses both classnames & content codes |
It looks like that's what the --codepoints option is for, I can't get it to work though. Here's what I'm trying:
My codepoints file looks like this: The codepoints file seems to get ignored though. === I am able to get it working using webfonts-generator though using this gulp script, but that project is no longer maintained and this one looks to be much better.
|
Had the same problem and managed to solve it using the {
"icon": "0xf100",
"icon2": "0xf101",
"icon3": "0xf102"
} |
Can you please share your full function string / settings? |
I don't have the code with me right now but if I remember correctly: I have a file called
and a folder containing 3 icons Then I generate the font using |
this is still an issue... if you provide the codepoints they just get overwritten anyways.... when debugging after line 40 in index.js
icon-font-generator/lib/index.js Line 40 in a9ac3b3
I get something in the lines like this:
this, after I created it the first time and the second time I passed the json creted as codepoints:
can someone shed some light on this? I think it get's messed up on line #160 icon-font-generator/lib/index.js Line 160 in a9ac3b3
|
You should use the hexadecimal notation for the unicode codepoints: If you need to use unicode literals, use the correct javascript notation ( const codePoint = codepointsMap[propName];
codepointsMap[propName] = Number.parseInt(codePoint) || codePoint.charCodeAt(0); |
I've updated the code to support unicode entries and added a sanity check so you get an error message if it does not understand the input. PR should be linked to this issue. |
Currently the characters will be generated in alphabetical order of the file names, but if an icon is added that isn't at the bottom of the list, it will be inserted and the character codes will be thrown off. This is fine for when you are using the class names for icons, but not when the character codes matter.
A workaround would be to prefix all your icons with a number:
ex:
01.close.svg
,02.arrow.svg
, etc.But it would ideally be nicer to keep the order without worrying about file names.
The text was updated successfully, but these errors were encountered: