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.
Summary
As stated in issue 328, this pull request provides access to the generated fonts in base64 formats so it is possible to embed the font inside the scss file while generating it (this is my particular use case)
Proposed changes
The proposed change is to add "fonts" to nunjucksOptions and one key for each generated font. Then, the key value is the base64 encoded content of the array (or generated file)
Related issue
Issue 328
Dependencies added/removed (if applicable)
None
How to test
I've modified line 68 of template.html.njk as follows:
from:
url("{{ fontPath }}{{ fontName }}.woff2?{{ cacheString }}{% if hash %}&v={{ hash }}{% endif %}") format("woff2")
to
url("data:font/woff2;base64,{{ fonts.woff2 }}") format("woff2")
And tested the document in a browser (Chrome), then, in the network tab you can see the font has been loaded from embeded resource rather than external URL.
Test configuration
Same original configuration