forked from AllienWorks/cryptocoins
-
Notifications
You must be signed in to change notification settings - Fork 0
/
gulpfile.js
85 lines (71 loc) · 1.81 KB
/
gulpfile.js
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
'use strict';
/* ------------------------------------ *\
Includes
\* ------------------------------------ */
var gulp = require('gulp');
// Pump - https://github.com/mafintosh/pump
var pump = require('pump');
// SVGO - https://www.npmjs.com/package/gulp-svgmin
var svgmin = require('gulp-svgmin');
// Iconfont - https://github.com/nfroidure/gulp-iconfont
var iconfont = require('gulp-iconfont');
// Iconfont CSS - https://github.com/backflip/gulp-iconfont-css
var iconfontCss = require('gulp-iconfont-css');
var fontName = 'cryptocoins';
var aliases = {
BC: ['BLK'],
'BC-alt': ['BLK-alt'],
BCH: ['BCC'],
'BCH-alt': ['BCC-alt'],
'NBT': ['USNBT'],
'STEEM': ['SBD'],
'NEO': ['GAS'],
'SIA': ['SC'],
'SJCX': ['STORJ'],
'STR': ['XLM'],
'MARKS': ['Bitmark']
}
/* ------------------------------------ *\
Paths
\* ------------------------------------ */
const paths = {
input: 'SVG/**/*.svg',
output: 'SVG/',
font_output: 'webfont/',
}
/* ------------------------------------ *\
Tasks
\* ------------------------------------ */
gulp.task('optimize', function (cb) {
console.log('-- Optimizing SVG files');
pump([
gulp.src(paths.input),
svgmin(),
gulp.dest(paths.output),
], cb );
});
gulp.task('webfont', function (cb) {
console.log('-- Generating webfont');
pump([
gulp.src(paths.input),
iconfontCss({
fontName: fontName,
path: 'src/icons-template.css',
targetPath: 'cryptocoins.css',
fontPath: '',
cssClass: 'cc',
aliases: aliases
}),
iconfont({
fontName: fontName,
prependUnicode: true,
formats: ['ttf', 'woff', 'woff2'],
normalize: true,
fontHeight: 1001,
descent: 200,
}),
gulp.dest(paths.font_output),
], cb );
});
gulp.task('default', ['optimize', 'webfont'], function (){
});