I'm using the font library font awesome. It works when the project is not built/uglified with grunt.
But when I'm building the project with grunt it's not working. I get this error in console: .../fonts/fontawesome-webfont.woff?v=4.0.3 404 (Not Found)
I've scaffolded the project with yeoman.
This is my ref in index.html
<!-- build:css styles/fontawesome.css -->
<link rel="stylesheet" href="bower_components/font-awesome/css/font-awesome.min.css">
<!-- endbuild -->
Any ideas what can be wrong?
Update I need to copy the folder /bower_components/font-awesome/fonts to dist/fonts. This needs to be done in the grunt-file. Probably under the "copy" options
copy: {
dist: {
files: [{
expand: true,
dot: true,
cwd: '<%= yeoman.app %>',
dest: '<%= yeoman.dist %>',
src: [
'*.{ico,png,txt}',
'.htaccess',
'bower_components/**/*',
'images/{,*/}*.{gif,webp}',
'styles/fonts/*'
]
}, {
expand: true,
cwd: '.tmp/images',
dest: '<%= yeoman.dist %>/images',
src: [
'generated/*'
]
}]
},
But I'm not really sure where to include this.
The simplest way to do this is to go to your own
bower.json
and add anoverrides
property.You will have to copypasta the fonts from the
fontawesome/fonts
folder your yourapp/fonts
folder manually. No editing ofGruntfile
orSCSS
or anything else required.As answered above this one worked very well for me too
If you are using the complete grunt task stack from yeoman then the
useminPrepare
task builds a combined stylesheet from all stylesheets that you put in thebuild:css
comment - as you do. (seehttps://github.com/yeoman/grunt-usemin
for additional informations) After the build process is done this file - somewhat like "vendor.234243.css" is copied to the styles folder. That's why the path for your font is no longer valid. There are at least 2 possibilities to solve this:You could remove the font-awesom css out of the
build:css
block:Copy the fonts
folder
as a sibling to thestyles
folder by an aditional grunt task in your gruntfile.My solution was to go with a CDN approach:
None of the answers worked for some reason.
If you're working with SailsJS and Bower, I've worked up a solution that fixes Fontawesome and Bootstrap font issues.
tasks/config/bower.js
looks similar to: https://gist.github.com/robksawyer/fc274120aef9db278eecremove.js
file intasks/config
: https://gist.github.com/robksawyer/2fcf036fdf02436aa90btasks/register/compileAssets
: https://gist.github.com/robksawyer/fa04a34ea103bead1c61tasks/config/copy.js
file to: https://gist.github.com/robksawyer/2aac6d0cdb73bfa8239fFor those using
Google App Engine
, the following worked for me:Add to
Gruntfile.js
:I am using LESS so I imported
font-awesome.less
by adding this to mymain.less
file.Then I added this to my
app.yaml
file.