Skip to content
Stefan Schüller edited this page Mar 7, 2016 · 10 revisions

Adding fonts installed with package manager is quite often a task. For instance, using font-awesome or any other similar library is a typical task one will need.

For this purpose, you can go through the following steps:

  1. In tools/config/project.config.ts:
...
export class ProjectConfig extends SeedConfig {
  PROJECT_TASKS_DIR = join(process.cwd(), this.TOOLS_DIR, 'tasks', 'project');

  FONTS_DEST = `${this.APP_DEST}/fonts`;
  FONTS_SRC = [
      'node_modules/bootstrap/dist/fonts/**'
  ];
...
  1. Create a file tools/tasks/project/build.fonts.ts:
import * as gulp from 'gulp';
import {FONTS_SRC, FONTS_DEST} from '../../config';

export = () => {
return gulp.src(FONTS_SRC)
      .pipe(gulp.dest(FONTS_DEST));
}
  1. In gulpfile.ts
// Build dev.
gulp.task('build.dev', done =>
runSequence('clean.dev',
            'tslint',
            'build.assets.dev',
            'build.fonts',    // Added task;
            'build.js.dev',
            'build.index.dev',
            done));
// Build prod.
gulp.task('build.prod', done =>
runSequence('clean.prod',
            'tslint',
            'build.assets.prod',
            'build.fonts',    // Added task;
            'build.html_css.prod',
            'build.js.prod',
            'build.bundles',
            'build.bundles.app',
            'build.index.prod',
            done));
// Build test.
gulp.task('build.test', done =>
runSequence('clean.dev',
            'tslint',
            'build.assets.dev',
            'build.fonts',    // Added task;
            'build.js.test',
            'build.index.dev',
            done));