Skip to content

Commit 57e7092

Browse files
committed
add "fonts" task for local and "vendorFonts" tasks for bower fonts
1 parent ee5fadb commit 57e7092

File tree

4 files changed

+34
-16
lines changed

4 files changed

+34
-16
lines changed

README.md

+3-2
Original file line numberDiff line numberDiff line change
@@ -22,12 +22,13 @@ Detailed documentation of our best practice workflow and the config object will
2222
## General
2323
- `bower:install` to install packages defined in the `bower.json`.
2424
- `bower:prune` to remove packages that are not used anymore.
25-
- `fonts` copies fonts defined in the bower dependencies to a particular distribution folder.
2625
- `images` collects graphics of different filetypes, flattens the paths and places them in a particular distribution folder.
27-
- `ìndex` injects the transpiled JavaScript and CSS into the `index.html`.
26+
- `index` injects the transpiled JavaScript and CSS into the `index.html`.
2827
- `jshint` runs jshint linting tool.
2928
- `clean` removes the distribution folder with all its content.
3029
- `statics` copies static files to a particular distribution folder.
30+
- `fonts` copies local fonts to a particular distribution folder.
31+
- `vendorFonts` copies fonts defined in the bower dependencies to a particular distribution folder.
3132

3233
## Stylesheets
3334
- `compass` compiles scss files to CSS files using [compass](https://github.com/Compass/compass).

index.js

+5-1
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ module.exports = function(gulp, tasks, config) {
2424
}
2525

2626
if (tasks.indexOf('fonts') !== -1) {
27-
require('./tasks/fonts')(gulp, config.debug, config.dist.fonts);
27+
require('./tasks/fonts')(gulp, config.app.fonts, config.dist.fonts);
2828
}
2929

3030
if (tasks.indexOf('images') !== -1) {
@@ -83,6 +83,10 @@ module.exports = function(gulp, tasks, config) {
8383
require('./tasks/statics')(gulp, config.app.statics, config.bases.dist);
8484
}
8585

86+
if (tasks.indexOf('vendorFonts') !== -1) {
87+
require('./tasks/vendorFonts')(gulp, config.debug, config.dist.fonts);
88+
}
89+
8690
if (tasks.indexOf('vendorScripts') !== -1) {
8791
require('./tasks/vendorScripts')(gulp, config.dist.js, config.sourcemapPath, config.production, config.debug);
8892
}

tasks/fonts.js

+8-13
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,14 @@
11
'use strict';
22

3-
var bowerFiles = require('main-bower-files'),
4-
gulpif = require('gulp-if'),
5-
debug = require('gulp-debug');
3+
//var gulpif = require('gulp-if'),
4+
// rev = require('gulp-rev'),
65

7-
8-
var fontsFilter = {
9-
filter: /\.(otf|eot|svg|ttf|woff)/i
10-
};
11-
12-
module.exports = function(gulp, debugFlag, dest) {
13-
gulp.task('fonts', ['bower:install', 'bower:prune'], function() {
14-
return gulp.src(bowerFiles(fontsFilter))
15-
.pipe(gulpif(debugFlag, debug()))
6+
module.exports = function(gulp, src, dest) {
7+
gulp.task('fonts', function () {
8+
return gulp.src(src)
9+
//.pipe(gulpif(config.rev, rev()))
1610
.pipe(gulp.dest(dest));
11+
//.pipe(gulpif(config.rev, rev.manifest()))
12+
//.pipe(gulpif(config.rev, gulp.dest(dest)));
1713
});
1814
};
19-

tasks/vendorFonts.js

+18
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
'use strict';
2+
3+
var bowerFiles = require('main-bower-files'),
4+
gulpif = require('gulp-if'),
5+
debug = require('gulp-debug');
6+
7+
8+
var fontsFilter = {
9+
filter: /\.(otf|eot|svg|ttf|woff)/i
10+
};
11+
12+
module.exports = function(gulp, debugFlag, dest) {
13+
gulp.task('vendorFonts', ['bower:install', 'bower:prune'], function() {
14+
return gulp.src(bowerFiles(fontsFilter))
15+
.pipe(gulpif(debugFlag, debug()))
16+
.pipe(gulp.dest(dest));
17+
});
18+
};

0 commit comments

Comments
 (0)