- Place the font files under src/scss/fonts
- If the font is FontAwesome, it must be named fontawesome-webfont.*
- Include the fonts with the $font-face compass mixin, do not specify a path in the mixin
- Specify { font: build/fonts } in your compass config
- Modify your gulpfile.js, so that the build and distribution steps copy the fonts to build/, and dist/
If you did everything well:
- Gulp should never complain about missing font files
- Your example pages for the component should show the fonts correctly
- Other componenets that embed your component should display the fonts correctly
@import "compass/css3/font-face";
@include font-face("FontAwesome", font-files("fontawesome-webfont.woff", "fontawesome-webfont.ttf", "fontawesome-webfont.svg", "fontawesome-webfont.eot"));
// compass config
return gulp.src('./src/scss/*.scss')
.pipe(compass({
project: __dirname,
sass: 'src/scss',
css: 'build',
font: 'build/fonts'
}));
// build step
gulp.task('copy-fonts-build', function () {
return gulp.src(__dirname + '/src/scss/fonts/*')
.pipe(gulp.dest(__dirname + '/build/fonts'));
});
// dist step
gulp.task('copy-fonts-dist', function () {
return gulp.src(__dirname + '/src/scss/fonts/*')
.pipe(gulp.dest(__dirname + '/dist/fonts'));
});