6 Star 3 Fork 1

福州塔联信息科技有限公司/pdfmake-fonts-build

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
克隆/下载
gulpfile.js 1.68 KB
一键复制 编辑 原始数据 按行查看 历史
asus-pc\asus 提交于 2018-06-04 14:34 . 更新 fonts 放入框
var gulp = require('gulp');
var webpack = require('webpack');
var mocha = require('gulp-spawn-mocha');
var eslint = require('gulp-eslint');
var each = require('gulp-each');
var fc2json = require('gulp-file-contents-to-json');
var log = require('fancy-log');
var PluginError = require('plugin-error');
var DEBUG = process.env.NODE_ENV === 'debug';
var CI = process.env.CI === 'true';
//var vfsBefore = "this.pdfMake = this.pdfMake || {}; this.pdfMake.vfs = ";
var vfsBefore = "pdfMake = pdfMake || {}; pdfMake.vfs = ";
var vfsAfter = ";";
gulp.task('build', function (callback) {
webpack(require('./webpack.config.js'), function (err, stats) {
if (err) {
throw new PluginError("webpack", err);
}
log("[webpack]", stats.toString({}));
callback();
});
});
gulp.task('test', function () {
return gulp.src(['./tests/**/*.js'])
.pipe(mocha({
debugBrk: DEBUG,
R: CI ? 'spec' : 'nyan'
}));
});
gulp.task('lint', function () {
return gulp.src(['./src/**/*.js'])
.pipe(eslint())
.pipe(eslint.format())
.pipe(eslint.failAfterError());
});
gulp.task('buildFonts', function () {
return gulp.src(['./fonts/*.*'])
.pipe(each(function (content, file, callback) {
var newContent = new Buffer(content).toString('base64');
callback(null, newContent);
}, 'buffer'))
.pipe(fc2json('vfs_fonts.js', {flat: true}))
.pipe(each(function (content, file, callback) {
var newContent = vfsBefore + content + vfsAfter;
callback(null, newContent);
}, 'buffer'))
.pipe(gulp.dest('build'));
});
gulp.task('watch', function () {
gulp.watch('./src/**', ['test', 'build']);
gulp.watch('./tests/**', ['test']);
});
gulp.task('default', gulp.series(/*'lint',*/ 'test', 'build', 'buildFonts'));
Loading...
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
1
https://gitee.com/talianshe/pafmake-fonts-build.git
git@gitee.com:talianshe/pafmake-fonts-build.git
talianshe
pafmake-fonts-build
pdfmake-fonts-build
master

搜索帮助