-
Notifications
You must be signed in to change notification settings - Fork 91
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
Request: support configurable url paths (like FontAwesome does it) #79
Comments
You suggesting we add scss support? |
@KyleAMathews Just those two very simple files. And that doesn't interfere with the |
I still don't understand what you want — you can't use the css files as they are in your projects? |
@KyleAMathews Nope. The existing So we edit each By parameterising the path (like Font Awesome does it), it is simple to manage this automatically during the build process. I'm not sure how to better explain, maybe someone else with the same use case could jump in on this. |
We control where files are for the typeface packages and they're always in the same place. You don't edit the CSS file. You just use it. Perhaps try out a typeface packages in a sample project? |
Our fonts and files don't end up in the same place as you, I guess. You obviously built the packages around you use case, which is fair. A complex system though won't follow this approach. Thanks anyway. (I'm still using these npm packages though, but the build scripts are just a little more complex. If anyone else does it the way I've described let me know and I'll share my approach - using npm scripts rather than gulp/grunt/etc). |
Same issue here. I am not exposing node_modules to web path, but instead I am compiling css from scss to another directory. I am using successfully font-awesome this way, but unfortunately it won't work with fonts from typefaces project. So for now I am manually copying them over to another directory and editing the css file. Which is not great for updates. |
Why was this closed? This is a pretty common problem, and the solution @lonix1 suggested is a good one -- both FontAwesome and IBM's Plex typeface use scss variables in the way they describe. |
This would fantastic if it were supported. I'm building standalone SCSS-based theme and having to use The approach @lonix1 suggests is good (and what some other font packages do). The only thing is that to ensure there's a $font-path: "./files" !default; // this is the default, but we can override it @KyleAMathews Could this be re-considered? Thanks! |
This implements KyleAMathews#79. This adds support to typeface packages by introducing a `_typeface.scss` partial, which at present exists to facilitate setting a font-path variable for a given typeface. This is to enable support of Sass-centric build systems, such as via sass directly, where font files will be copied/put into a known location by another process. The implementation means this is possible: ``` $open-sans-font-path: "../fonts/open-sans" !default; @import "typeface-open-sans/typeface"; ``` 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. Ideally, it would have been `index.scss` or `_index.scss` to enable a simple `@import "typeface-open-sans"` from within Sass, but this causes ambiguity with the existing `index.css` file and 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 gives flexibility over one `$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 build for full backward compatibility.
This implements KyleAMathews#79. This adds support to typeface packages by introducing a `_typeface.scss` partial, which at present exists to facilitate setting a font-path variable for a given typeface. This is to enable support of Sass-centric build systems, such as via sass directly, where font files will be copied/put into a known location by another process. The implementation means this is possible: ``` $open-sans-font-path: "../fonts/open-sans" !default; @import "typeface-open-sans/typeface"; ``` 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. Ideally, it would have been `index.scss` or `_index.scss` to enable a simple `@import "typeface-open-sans"` from within Sass, but this causes ambiguity with the existing `index.css` file and 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 gives flexibility over one `$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 build for full backward compatibility.
The
index.css
references fonts in the./files/
directory, so the declaration has this for example:But what if our assets aren't structured that way, so the fonts aren't in
./files/
?It is easy to solve this using the same approach as Font Awesome. For each package add two new files:
_variables.scss
andindex.scss
._variables.scss
has one line:index.scss
file:So our build scripts can redefine
$font-path
and include all theindex.scss
files. Very easy.And this would be alongside the existing
index.css
so it wouldn't break anything for existing users.SUMMARY
Just add two new files with the stuff above. Nothing else changes.
The text was updated successfully, but these errors were encountered: