References to font (font-awesome) resources are not updated in yeoman/angular grunt build

All we need is an easy explanation of the problem, so here it is.

I’m aware of the SO threads about this (I’ve linked them below), but unfortunately I couldn’t solve this with them, so please allow me this question ๐Ÿ™‚

I’ve bootstrapped an AngularJS project with Yeoman and thus rely on a grunt.js build utilizing bower.js and SCSS.
I want to use font-awesome and the glyphicons-halflings-regular from bootstrap-sass-official.
When running “grunt serve” everything is fine, but when I want to create a fileset for distribution, the references to the font files are not updated as they should.

The main.scss contains

$icon-font-path: "../bower_components/bootstrap-sass-official/vendor/assets/fonts/bootstrap/";
@import 'bootstrap-sass-official/vendor/assets/stylesheets/bootstrap';

$fa-font-path: "../bower_components/font-awesome/fonts/";
@import "font-awesome/scss/font-awesome";

but the outcome in the dist/styles/123456.main.css are references like


So, to me it looks like the path is updated (to the tmp path) but not with the right value for “dist”.
I tried to fiddle with the copy and rev tasks in the gruntfile but haven’t found the right trigger to pull, yet ๐Ÿ™

Threads and other sources I used to find a solution for this:

Any hints how I could takle this?

How to solve :

I know you bored from this bug, So we are here to help you! Take a deep breath and look at the explanation of your problem. We have many solutions to this problem, But we recommend you to use the first method because it is tested & true method that will 100% work for you.

Method 1

Finally, I figured it out ๐Ÿ™‚

I pinned down cssmin to be the bad guy in this game: It was responsible for writing the .tmp paths into the final css file. To solve this, I added the noRebase: true, option to the cssmin task in Gruntfile.js .

To get along with the font references, I also used the copy task to copy the fonts into my dist folder and had to use $icon-font-path: "../fonts/" to have it finally in the right format.

Maybe this will help someone stuck in a similar situation ๐Ÿ™‚

Method 2

Here’s my solution. I don’t mess with the font-awesome scss at all. So all I need is a way to treat font-awesome similar to bootstrap, add css or js and then done with it.

If you open bower.json for under your yoeman build folder, you can change the overrides section to the following,

"overrides": {
"bootstrap": {
  "main": [
"font-awesome": {
  "main": [


once you do that, your font-awesome.css will show up in index.html build section like

<link rel="stylesheet" href="bower_components/bootstrap/dist/css/bootstrap.css" rel="nofollow noreferrer noopener" />
<link rel="stylesheet" href="bower_components/font-awesome/css/font-awesome.css" rel="nofollow noreferrer noopener" />

Of course, this assume that you won’t mess up with scss, therefore you can delete the build section inside main.scss, used to be

// bower:scss
@import "bower_components/font-awesome/scss/font-awesome.scss";
// endbower

After you done that, your grunt serve should work right away. In order to get grunt build work, you just need to keep the relationship between fonts folder and css folder of fontawesome, which means copy the fonts to /fonts, the grunt file will look like,

    }, {
      expand: true,
      cwd: 'bower_components/bootstrap/dist',
      src: 'fonts/*',
      dest: '<%= yeoman.dist %>'
    }, {
      expand: true,
      cwd: 'bower_components/font-awesome/',
      src: 'fonts/*',
      dest: '<%= yeoman.dist %>'

In short, I treated fontawesome same as bootstrap without any customization.

Method 3

I have not run into this problem probably because I use relative path to my font files and the same path works without modifications when I build a dist. I just have one copy task that does:

copy: {
      fonts: {
        src: 'fonts/*',
        dest: 'dist/',

Note: Use and implement method 1 because this method fully tested our system.
Thank you ๐Ÿ™‚

All methods was sourced from or, is licensed under cc by-sa 2.5, cc by-sa 3.0 and cc by-sa 4.0

Leave a Reply