-
Notifications
You must be signed in to change notification settings - Fork 666
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
How to add fontawesome #337
Comments
I did something like: gulp.task('html', ['inject', 'partials'], function () {
...
return gulp.src(paths.tmp + '/serve/*.html')
...
.pipe($.replace('../bower_components/bootstrap-sass-official/assets/fonts/bootstrap', 'fonts'))
.pipe($.replace('../bower_components/fontawesome/fonts', 'fonts'))
... As the fonts should be automatically copied to Also to get the bootstraph glyphicons working for .pipe($.replace('../bootstrap-sass-official/assets/fonts/bootstrap', 'fonts'))` with: .pipe($.replace('../bower_components/bootstrap-sass-official/assets/fonts/bootstrap', 'fonts'))` Which might be an issue with the generator or I'm just doing something wrong ... |
The current font task only copy fonts declared in bower packages. It's the case for bootstrap, I don't know for fontawesome. After that we put the font in a specific directory. Secondly, we have to replace the font path as you seen to point the right directory in the dist directory structure. First of all, have you your font files in the dist directory ? |
Also my bad in my previous comment. I was using an different version of font awesome that didn't have the fonts declared in One thing though, is the new font awesome causes an error if the .woff2 font isn't copied to the gulp.task('fonts', function () {
return gulp.src($.mainBowerFiles())
.pipe($.filter('**/*.{otf,eot,svg,ttf,woff,woff2}'))
... |
yeah, woff2 has been added recently to the scripts and not released yet i think |
Awesome. It's all working now. The scss import looks like $fa-font-path: "../../bower_components/fontawesome/fonts";
@import "../../bower_components/fontawesome/scss/font-awesome.scss"; and I had to add a step to the .pipe($.replace('../../bower_components/fontawesome/fonts', '../fonts')) |
@domoritz I'm sorry, but how did you achieve to get it working in development? Could you post the complete steps? Thank you Edit - also, could you say which version of font-awesome was used? Mine here was installed by Edit 2 - Ok, for development I just did what you said up here with a little change to the path since mine has a dash, so:
...and now it works on development, but still doesn't for production (gulp build), would you mind helping me around? |
Our project is here. https://github.com/uwdata/polestar |
I'm having the same problem, fontawesome works with serve but not included in dist folder after build |
To get it working for serve:dist a workaround could be found at issue #637. |
Just in case, for LESS solution will be:
|
+1 |
@claboran i tried that solution but still not sure how to do with font-awesome, how am i supposed to do it? is there any fix or do i have to manually copy the font awesome folder? |
@dgoncalves1 I've been struggling with this and my solution was:
With this step you'll see FA icons in dev mode (src). 2.In gulp/build.js there's a task called
So far, it's the solution proposed in recipes and everything works great in dev mode BUT when you run the BUILD task it won't copy FA fonts to the dist/fonts folder because they must be declared in your
I used a wildcard, inside the file Bootstrap fonts are declared explicitly, that's your choice. Hope this helps. |
@dgoncalves1 : Did it work now for serve:dist? |
It took me a while to get Font Awesome working so I'm adding what I did (I think things have changed since some comments above were written).
|
Why not just use the cdn: https://www.bootstrapcdn.com/fontawesome/ |
@claboran haven't had the time to do it, as soon as I can I'll provide feedback. |
Hey guys, I've been dealing with an issue that might be related to this. I'm using the latest release of the generator that already includes the When running both from When building the project I can't find the fonts in the I found some known issues with Firefox that make the icons not appear in it, but they are all related to CDN Access Rights, but since I'm not using any CDN, I thought that I should ask here first. I hope someone can help. |
I have done what @danieldiazastudillo told but for LESS, and did not worked for me. I have added this to my // bower:less
// endbower
[...]
@fa-font-path: '../../bower_components/font-awesome/fonts';
@import '../../bower_components/font-awesome/less/font-awesome.less';
[...]
// injector
// endinjector And then on .pipe($.replace('../../bower_components/bootstrap/fonts/', '../fonts/'))
.pipe($.replace('../../bower_components/font-awesome/fonts/', '../fonts/')) And still does not work! :( DEBUG specifications: $ gulp --version
[01:25:52] CLI version 3.9.0
[01:25:52] Local version 3.9.0 $ npm --version
2.13.4 $ bower --version
1.5.3 $ node --version
v0.12.7 At last, the generator |
Instead of modifying any file in the gulp build, I added the following section to my project's bower.json:
|
@olimungo you ONLY edited the And are you using CSS, LESS or SASS? |
@poliveira89 Yes, that's what I like in this solution. And I used Sass with Node. |
@olimungo but for what I have been looking for on "fonts" task with But if I "override" it like you say, in theory the problem will be the same... :/ |
@danieldiazastudillo Thanks. Now my project works well after running |
Its not working my dist folder. My console is throwing this error. http://localhost:3000/bower_components/font-awesome/fonts/fontawesome-webfont.woff2?v=4.4.0 Failed to load resource: the server responded with a status of 404 (Not Found) I added in gulp/build.js In index.scss Its working fine in serve but not in build |
The recipe seems incomplete because when you build to dist using the the You will need to modify the bower.json of your project for the files to be copied:
Then, you will need to modify the gulp/build.js (lines 53 and 54 in the 'html' task) file to make sure that the path to these font-awesome font files is correct:
And finally, you will need to specify the $fa-font-path in you scss file (ie. index.scss):
Hope it helps and that I didn't forget anything. ;-) |
We installed font awesome via this shim repository: https://github.com/components/font-awesome and it works just fine. Probably because their bower.json correctly lists all the font files. |
I had the same issue when using |
Same for me - @gablabelle 's solution works, many thanks! Just something that took me quite a while, even though it was pretty obvious: make sure to do the replacements in
|
just tried it again without the shim and yes, the recipe is incomplete, @gablabelle version works! Correction: it made it work for |
@mzellhofer why do we need to put it after |
moving down the font awesome replace is not working though
anything else for proper working ? even all my fonts are being copied to dist/fonts folder |
thanks @gablabelle ; I have followed your steps but with minimal changes; and now running bower.json
in build.js
also added otf in gulp.task('font')
|
Pay attention to FontAwesome folder name: now it is |
I'm struggling with getting fontawesome to work with the generated gulp.
I tried to copy the files with a new gulp task in
build.js
And added the following to the scss file.
This works fine for development but breaks in dist (because the relative location of the css file changes. How do I set up the paths correctly? Can I use the
fonts
task?Or in other words. How do I make sure that relative paths to fonts in scss don't break in production?
The text was updated successfully, but these errors were encountered: