Add SCSS support (for configuring font paths) #161
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.
This implements #79.
This adds support to typeface packages by adding
_typeface.scss
partial for setting a font-path variable. This is to enable support of Sass-centric build systems (eg sass directly, Bootstrap, etc) where files will be copied/put into a known location by another process (but not 'discovered' as in webpack).The implementation means this is possible:
and the resulting CSS is populated with the correct font-path as set.
The naming of the imported partial is arbitrary -- it could just as easily be
fonts
or something else, buttypeface
seemed logical since it is the whole typeface. Ideally, it would have been ideal to name itindex.scss
or_index.scss
to enable a simple@import "typeface-open-sans"
from within Sass, but this causes ambiguity with the existingindex.css
file. As such, Sass won't build if both files are present (it used to be a warning and is now an error).The choice to have typeface-specific variable names (eg
$open-sans-font-path
) gives flexibility over one generic$font-path
variable so you can set different paths for different typefaces. Plus, being more specific means less chance of a conflict in existing projects.The implementation in the code itself adds only a few minor changes to the build script and templates. There are no changes to the existing CSS builds for full backward compatibility.