Skip to content

Commit 7c3f60f

Browse files
author
Shuwen Qian
committed
Inline woff as base64 data uri
1 parent bc2fdfa commit 7c3f60f

2 files changed

Lines changed: 4 additions & 6 deletions

File tree

Gulpfile.js

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@ var ghPages = require('gulp-gh-pages');
3434
var through = require('through2');
3535
var hogan = require('hogan.js');
3636
var header = require('gulp-header');
37+
var base64 = require('gulp-base64');
3738

3839
var SRC = 'src/';
3940
var BUILD = 'build/';
@@ -115,15 +116,13 @@ gulp.task('build', function(cb) {
115116
});
116117

117118
gulp.task('build:prod', ['build'], function() {
118-
var assets = gulp.src(path.join(BUILD, '**/*.woff'))
119-
.pipe(changed(DIST))
120-
.pipe(gulp.dest(DIST));
121-
var lib = gulp.src(BUILD + 'strand.html')
119+
return gulp.src(BUILD + 'strand.html')
122120
.pipe(vulcanize({
123121
inlineScripts:true,
124122
inlineCss:true,
125123
stripExcludes:false
126124
}))
125+
.pipe(base64(['.woff']))
127126
.pipe(htmlmin({
128127
quotes: true,
129128
empty: true,
@@ -133,8 +132,6 @@ gulp.task('build:prod', ['build'], function() {
133132
.pipe(header(`<!--\n${fs.readFileSync('BANNER.txt').toString('utf8')}\n-->`))
134133
.pipe(changed(DIST))
135134
.pipe(gulp.dest(DIST));
136-
137-
return merge(assets, lib);
138135
});
139136

140137
/** DOCS **/

package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@
1919
"event-stream": "^3.3.2",
2020
"glob": "^5.0.15",
2121
"gulp": "^3.9.0",
22+
"gulp-base64": "^0.1.3",
2223
"gulp-bump": "^1.0.0",
2324
"gulp-cached": "^1.1.0",
2425
"gulp-changed": "^1.3.0",

0 commit comments

Comments
 (0)