-
Notifications
You must be signed in to change notification settings - Fork 30
/
Copy pathgulpfile.js
37 lines (34 loc) · 1.07 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
var gulp = require('gulp');
var args = require('yargs').argv;
var iconfont = require('gulp-iconfont');
var consolidate = require('gulp-consolidate');
var sourceDir = 'svgs/' + args.font;
var fontName = args.font;
var cssTemplate = 'style';
var htmlTemplate = 'index';
var className = 'icon-' + args.font;
var dist = 'dist/' + args.font;
var tmp = 'tmp/' + args.font;
gulp.task('default', function() {
gulp.src([sourceDir + '/*.svg'])
.pipe(iconfont({
fontName: fontName,
normalize: true,
descent: 75
}))
.on('codepoints', function(codepoints) {
var options = {
glyphs: codepoints,
fontName: fontName,
cssTemplate: cssTemplate,
className: className
};
gulp.src('templates/' + cssTemplate + '.css')
.pipe(consolidate('lodash', options))
.pipe(gulp.dest(dist)); // set path to export your CSS
gulp.src('templates/' + htmlTemplate + '.html')
.pipe(consolidate('lodash', options))
.pipe(gulp.dest(dist)); // set path to export your sample HTML
})
.pipe(gulp.dest(tmp));
});