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
| const gulp = require('gulp'); const iconfont = require('gulp-iconfont'); const iconfontCss = require('gulp-iconfont-css'); const clean = require("gulp-clean"); const gulpSequence = require('gulp-sequence')
const fontName = 'icon'
gulp.task('build', () => { return gulp.src('./svg/*.svg') .pipe(iconfontCss({ fontName: fontName, path: './templates/iconfont.css', targetPath: '../css/iconfont.css', fontPath: '../fonts/' })) .pipe(iconfont({ fontName: fontName, formats: ['svg', 'ttf', 'eot', 'woff', 'woff2'], normalize: true, options: { fixedWidth: false, normalize: false, fontHeight: 512, descent: -32, normalize: true } })) .on('glyphs', function (glyphs, options) { }) .pipe(gulp.dest('./icon/fonts/')); })
gulp.task('clean', () => { return gulp.src('./icon', { read: false }) .pipe(clean()) })
gulp.task('default', gulpSequence('clean', 'build', () => { console.log('end!') }))
|