-
Notifications
You must be signed in to change notification settings - Fork 1.4k
Add external fonts
Dinsitro edited this page Feb 25, 2016
·
10 revisions
Adding fonts installed with package manager is quite often 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:
- In
config.ts
:
export const FONTS_DEST = `${APP_DEST}/fonts`;
export const PROD_NPM_DEPENDENCIES: IDependency[] = normalizeDependencies([
// ...
{ src: "bootstrap/dist/fonts/**", inject: false, dest: FONTS_DEST }
]);
- For the production build, in 'build.fonts.prod' task:
import {join} from 'path';
import {PROD_DEPENDENCIES, FONTS_DEST} from '../config';
export = function buildFonts(gulp, plugins) {
function getFonts() {
return PROD_DEPENDENCIES.filter(d => /\.(ttf|svg|otf|eot|woff|woff2)$/.test(d.src));
}
return function () {
return gulp
.src(getFonts().map(r => r.src))
.pipe(gulp.dest(FONTS_DEST));
}
};