-
Notifications
You must be signed in to change notification settings - Fork 42
Generating a font multiple times with the same icons & font config results in different hash and file contents #10
Comments
That is indeed weird. I use WebPack’s functions to generate me a hash, but that the files themselves also tend to be "unique" is interesting. If you look at the project’s package.json, youll see the module that is actually used to generate the fonts. Maybe you should open the issue there, as this loader is merely a proxy to that module. But, very interesting. I should at least add it to the readme, because I have no idea where this is comming from, except that it might be from the underlying module. |
I've also bumped into this behavior. I have a hunch that it might be an embedded timestamp (generated at ...). |
@chunksnbits @scottmcnab |
I think it's caused by the svg2ttf package, which embeds the current date in the generated ttf font: https://github.com/fontello/svg2ttf/blob/875ed81a4f1cd6414351ed5eec636af595e043ad/lib/sfnt.js#L8 |
Nice finding. Should we raise an isse then? a potential fix would be to use a constant string or user controlled value. Von meinem iPhone gesendet
|
I would like to test my hypothesis first and eventually submit a pull request, but I have few hours to spare right now. I'll eventually get to it, but it's not a huge priority for me :) |
I too verified this coming from the deeper font generators with the exception of svg that has persistent output and therefor persistent hash. the svg2ttf package supports I've created sunflowerdeath/webfonts-generator#6 to allow passing arbitrary options directly to the generators. I will update here once there is progress with the PR UPDATE |
Oooooooh, fancy! I'll see if I need to adjust anything on my loader end to bridge the gap! Awesomely done @mrbar42 ! |
Working on an update. You can simply pass down a |
Use 0.2.1, it has the fix now. |
One last note... Unfortunately the webfonts-generator uses older version of the underlying ttf generator so it's not in effect yet. |
Yeah I saw that PR. Waiting for it to be merged too!
|
Merged and published. |
Nice work guys! 👍 |
If the fileName in the font config includes the [hash] parameter, then the generated hash (and hence target filename) is different every time webpack is run.
For example, the default fileName setting of "[hash]-[fontname][ext]" has this issue.
This is problematic if generated files are committed to source control, since new files will be generated for every single build, even if none of the source icons or config files have changed!
Note: the contents of the generated font files (the .eot, .ttf and .woff files) are also different for each build, even if the source files have not changed. This is true even if using a fileName configuration without a hash in it, such as "[fontname][ext]".
For the same set of input icons, and exact same font config, then the generated files should be binary identical, and also the [hash] used to generate the target fileName.
The text was updated successfully, but these errors were encountered: