Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
The purpose of this change is to add a new option: emitCodepoints, as described in the changed README.md
It allows for the person using the loader to generate one of more codepoint files, containing both the user set and the auto generated codepoints. It is handy for use both on html pages or required directly in the webpacked source code, in both cases in order to be able to generate icons programatically without the need to set up the codepoints in advance.
Here is a working example, based on the example available at the "test" folder
entry.js
myfont.font.js
myfont2.js
index.html
With the resulting page being the following:
The code change is very limited:
emitCodepoints
option in either the fontConfig and the loader optionsemit-codepoints.js
module is loaded and itsemitFiles
method calledThe
emit-codepoints.js
module exports two methods:createArrayCodepointFiles(codepointFiles, elem)
: takes an Array as first parameter to which it appends the option received as second parameter, normalized.emitFiles(loaderContext, emitCodepointsOptions, generatorOptions)
: it takes the loader context (thethis
variable in the loader), the option received either in the font configuration file or the loader option and the generator Options (after it already generated the codepoints), generates the normalized array of codepoint files (with the appropriated names and types), transverses it and emit the files as requested.Hoping this is a valuable addition worthy of inclusion
Best regards