-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathgulpfile.js
More file actions
85 lines (72 loc) · 2.23 KB
/
gulpfile.js
File metadata and controls
85 lines (72 loc) · 2.23 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
const gulp = require('gulp');
const path = require('path');
const { convertAllFonts } = require('@hayes0724/web-font-converter');
const hbjs = require('handbrake-js');
var flatmap = require('gulp-flatmap');
const node_xj = require("xls-to-json");
/*Export fonts
ttf -> woff
ttf -> woff2
svg -> ttf
svg -> ttf -> woff
svg -> ttf -> woff2
otf -> svg
otf -> svg -> ttf
otf -> svg -> ttf -> woff
otf -> svg -> ttf -> woff2 */
const convertFont = module.exports = function(){
convertAllFonts ({
pathIn: './fonts/input-fonts',
pathOut: './fonts/output-fonts',
outputFormats: ['.woff2'],
inputFormats: ['.otf'],
debug: false
})
}
gulp.task('convertFont', convertFont);
/* Convert video (handbrake-js) example for webm -> mp4 */
const convertVideo = module.exports = function(){
return gulp.src('./video-converter/input-webm/*.webm')
.pipe(
flatmap(function(stream,file){
var filename = path.basename(file.path);
var justfilename = path.basename(file.path, '.webm');
console.log( 'File to conver: ',filename);
hbjs.spawn({ input: './video-converter/input-webm/'+filename, output: './video-converter/output-mp4/'+justfilename+'.mp4', crop: 'no-loose-crop' })
.on('error', err => {
console.log('error: invalid user input');
})
.on('progress', progress => {
console.log(
'Percent complete: %s, ETA: %s',
progress.percentComplete,
progress.eta
)
})
return stream;
})
);
}
gulp.task('convertVideo', convertVideo);
// var build = gulp.series();
// exports.default = build;
// notworking
const xlstojson = module.exports = function(){
node_xj(
{
input: "./xls-to-json/spispna.xls", // input xls
output: "./xls-to-json/output.json", // output json
sheet: "sheetname", // specific sheetname
rowsToSkip: 0, // number of rows to skip at the top of the sheet; defaults to 0
allowEmptyKey: true, // avoids empty keys in the output, example: {"": "something"}; default: true
},
async function (err, result) {
if (err) {
console.error(err);
} else {
console.log(result);
}
}
);
}
gulp.task('xlstojson', xlstojson);