icon-gulp
'use strict';
var gulp = require('gulp');
var iconfont = require('gulp-iconfont');
var iconfontCss = require('gulp-iconfont-css');
var fontName = 'Icons';
gulp.task('iconfont_styles', function(){
gulp.src(['src/assets/images/icons/*.svg'])
.pipe(iconfontCss({
fontName: fontName,
path: 'src/assets/images/icons/_icons.scss',
targetPath: '../../styles/_icons.scss',
}))
.pipe(iconfont({
fontName: fontName,
normalize:true,
formats: ['ttf', 'woff', 'svg'],
}))
.pipe(gulp.dest('src/assets/fonts/'));
});
gulp.task('iconfont_variable', function(){
gulp.src(['src/assets/images/icons/*.svg'])
.pipe(iconfontCss({
fontName: fontName,
path: 'src/assets/images/icons/_icons-variables.scss',
targetPath: '../../styles/_icons-variables.scss',
}))
.pipe(iconfont({
fontName: fontName,
normalize:true,
formats: ['ttf', 'woff', 'svg'],
}))
.pipe(gulp.dest('src/assets/fonts/'));
});
gulp.task('icon_preview', function(){
gulp.src(['src/assets/images/icons/*.svg'])
.pipe(iconfontCss({
fontName: fontName,
path: 'src/assets/images/icons/_icon-preview.html',
targetPath: '../../../temp/icon-preview.html',
}))
.pipe(iconfont({
fontName: fontName,
normalize:true,
formats: ['ttf', 'woff', 'svg'],
}))
.pipe(gulp.dest('src/assets/fonts/'));
});
gulp.task('icon', ['iconfont_variable', 'iconfont_styles', 'icon_preview']);