-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathgulpfile.js
36 lines (31 loc) · 891 Bytes
/
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
var gulp = require('gulp');
var iconfont = require('gulp-iconfont');
var iconfontCss = require('gulp-iconfont-css');
var fs = require('fs');
var zip = require('gulp-zip');
var fontName = 'sushicons';
gulp.task('iconfont', function(done){
var icons;
gulp.src(['icons/*.svg'])
.pipe(iconfontCss({
fontName: fontName,
path: 'css/template.css',
targetPath: '../style.css',
fontPath: 'font/'
}))
.pipe(iconfont({
fontName: fontName
}))
.on('codepoints', function(codepoints, options) {
icons = codepoints.map(function(el) { return 'si-' + el.name; });
})
.pipe(gulp.dest('dist/font'))
.on('end', function(){
fs.writeFileSync('icon-list.json', JSON.stringify(icons));
gulp.src('dist/*')
.pipe(zip('sushicons.zip'))
.pipe(gulp.dest('.'))
.on('end', done);
});
});
gulp.task('default', ['iconfont']);