Created
August 25, 2017 07:09
-
-
Save prosenjit-manna/89d289a797a622667e77eeb0d8259ff8 to your computer and use it in GitHub Desktop.
icon-gulp
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
'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']); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment