javascriptnode.jsgruntjsgrunt-contrib-copyfont-awesome-4

Grunt copy and fontawesome fonts


I have installed fontawesome with bower and am using grunt's "grunt-contrib-copy" to copy it to a diff directory.

When I manually copy it, the font works ... but, when grunt does it, they do not work.

Now, I checked the files, and I noticed grunt's copy does the work, it increases the file size !

The file sizes from fontawesome :

  85908  FontAwesome.otf
  56006  fontawesome-webfont.eot
 287007  fontawesome-webfont.svg
 112160  fontawesome-webfont.ttf
  65452  fontawesome-webfont.woff

The file sizes after grunt copied them :

 163355  FontAwesome.otf
 101913  fontawesome-webfont.eot
 287008  fontawesome-webfont.svg
 143313  fontawesome-webfont.ttf
 120957  fontawesome-webfont.woff

Here i my gruntfile.js snippet :

      'fontawesome-fonts': {
        expand: true,
        cwd: 'public/vendor/fontawesome/fonts',
        src: '*',
        dest: path.join(__dirname, 'public', 'fonts')
      }

Solution

  • It seems as though grunt-copy is incapable of copying binary files correctly (sometimes?)

    So, it is recommended to not use it for binary files - images, music, videos, fonts, etc.

    EDIT: One possible method of fixing this which worked for me was as mentioned at https://github.com/gruntjs/grunt-contrib-copy/issues/64, use processContent: false or processContentExclude: ['**/*.{png,gif,jpg,ico,psd}'] in the options section of copy.