1

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')
      }
Ankit Chhatbar
  • 342
  • 2
  • 8
  • 19
AbdealiLoKo
  • 3,261
  • 2
  • 20
  • 36
  • Did you try searching -> http://stackoverflow.com/questions/21310382/fontawesome-is-not-working-when-project-is-built-with-grunt – adeneo Jan 10 '15 at 08:22
  • Yes, I saw that question earlier ... It is a completely different error from mine and not applicable here – AbdealiLoKo Jan 10 '15 at 08:43
  • Am I right that your problem is in the [grunt-contrib-copy](https://github.com/gruntjs/grunt-contrib-copy) changes files size? Which OS and file system do you use? – raidendev Jan 10 '15 at 16:26

1 Answers1

0

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.

AbdealiLoKo
  • 3,261
  • 2
  • 20
  • 36
  • what do we use then for copying these files? – James May 15 '16 at 21:48
  • You can use `processContentExclude` which tells grunt-copy that it should not touch specific files other than copying it - https://github.com/gruntjs/grunt-contrib-copy/issues/64 – AbdealiLoKo May 15 '16 at 23:27
  • It actually turned to be something completely different in my case. Font files were already getting copied just fine. – James May 19 '16 at 06:44