forked from kitian616/jekyll-TeXt-theme
-
Notifications
You must be signed in to change notification settings - Fork 0
/
gulpfile.js
71 lines (65 loc) · 1.8 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
const gulp = require('gulp');
const rename = require('gulp-rename');
const svg2png = require('gulp-svg2png');
const ico = require('gulp-to-ico');
const iconBasename = 'icon';
const iconDestPath = './assets/images/logo';
const faviconDestPath = './';
function coverSvg(width, height) {
height || (height = width);
return gulp.src('./assets/images/logo/logo.svg')
.pipe(svg2png({ width: width, height: height }))
.pipe(rename({
basename: iconBasename,
suffix: `-${width}x${height}`
}))
.pipe(gulp.dest(iconDestPath));
}
gulp.task('icon310', function() {
return coverSvg(310);
});
gulp.task('icon310x150', function() {
return coverSvg(310, 150);
});
gulp.task('icon192', function() {
return coverSvg(192);
});
gulp.task('icon180', function() {
return coverSvg(180);
});
gulp.task('icon167', function() {
return coverSvg(167);
});
gulp.task('icon152', function() {
return coverSvg(152);
});
gulp.task('icon150', function() {
return coverSvg(150);
});
gulp.task('icon128', function() {
return coverSvg(128);
});
gulp.task('icon120', function() {
return coverSvg(120);
});
gulp.task('icon70', function() {
return coverSvg(70);
});
gulp.task('icon48', function() {
return coverSvg(48);
});
gulp.task('icon16', function() {
return coverSvg(16);
});
gulp.task('favicon', ['icon128', 'icon48', 'icon16'], function() {
return gulp.src([
`${iconDestPath}/icon-128x128.png`,
`${iconDestPath}/icon-48x48.png`,
`${iconDestPath}/icon-16x16.png`])
.pipe(ico({ path: 'favicon.ico'}))
.pipe(gulp.dest(faviconDestPath));
});
gulp.task('icons', [
'icon310', 'icon310x150', 'icon192', 'icon180', 'icon167', 'icon152', 'icon150', 'icon120', 'icon70'
]);
gulp.task('artwork', ['favicon', 'icons']);