0

My icon font files are generating just fine, but the css is not generating at all. Below is a simplified version of my gulp file, which is not working. What am I missing? I'm very new to gulp.

var gulp = require('gulp'),
iconfont = require('gulp-iconfont'),
consolidate = require('gulp-consolidate');

var fontName = 'lrcd';
gulp.task('iconfont', function(){
  gulp.src(['icons/*.svg'])
  .pipe(iconfont({ fontName: fontName }))
  .on('codepoints', function(codepoints) {
    gulp.src('icons/templates/icons.css')
    .pipe(consolidate('lodash', {
      glyphs: codepoints,
      fontName: fontName,
      fontPath: 'icons/',
      className: 'icon'
    }))
    .pipe(rename({ basename:fontName }))
    .pipe(gulp.dest('css/'));
  })
  .pipe(gulp.dest('icons/'));
});

gulp.task('default', ['iconfont']);

My directories are set up as follows:

  • /css
  • /icons/templates/icons.css
  • /icons/svg/...(contains icon svgs)
Lauren
  • 255
  • 4
  • 13

3 Answers3

0

This line is questionable: .pipe(rename({ basename:fontName })). What library is that from and where are you requiring it? Try removing that and running gulp again. Update your question with any console errors in your node console.

Stephen Brickner
  • 2,584
  • 1
  • 11
  • 19
  • Removed... no luck. I'm not sure what library it was from. I copied it along with the rest of the code from some other (working) implementation of this -- one of the many examples from around the web that I've attempted to follow without success. – Lauren Jul 25 '15 at 02:56
0

Check out that your gulp-iconfont version is compatible with your templates. There were breaking compatibility changes in the last major updates ;).

nfroidure
  • 1,531
  • 12
  • 20
0

what's your gulp-iconfont version because they've changed their structures. you are using 'codepoints' but you need to use 'unicode' instead of that.