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.
I've edited my Gruntfile.js as follows:
I'm using yeoman 1.4.7 and its angular generator. It's very important to add copy:app and not only copy:dist task (as suggested above). If you don't include copy:app when you enter
grunt serve
it's not going to work. With copy:dist you're only consideringgrunt serve:dist
I was having the very same problem. I took a look a the bower.json file for font-awesome and found this:
There was no reference to the "font-awesome.css" in the "main" array. Perhaps, like me, you're not using SASS or LESS for styling. So no styles are being added for font-awesome. I modified the json file as follows:
I saved and ran grunt serve, and now my font-awesome icons show up.
Hope this helps.
I had the same problem. The following code solved my problem.