Skip to content

Commit a817c00

Browse files
committed
build icon font only if svg changed
1 parent a13be8f commit a817c00

File tree

2 files changed

+6
-9
lines changed

2 files changed

+6
-9
lines changed

.gitignore

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
/htdocs/img/gv/
55
/htdocs/login/css/
66
/src/img/gv/
7-
/src/less/iconfont.less
7+
/src/less/iconfont
88
/tests/test-forms/err.log
99
/tests/tests.log
1010
/tests/tests.html

gulpfile.js

Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -114,7 +114,6 @@ gulp.task('lesshint', function () {
114114
* includes (path with **) filtered, change check by gulp-less-changed
115115
*/
116116
watchFilesFor.less = [
117-
path.join(srcDir, 'less', '**', '*.less'),
118117
path.join(srcDir, 'less', '*.less'),
119118
path.join(srcDir, 'less', 'login', '*.less')
120119
];
@@ -230,8 +229,7 @@ gulp.task('imagemin', () => {
230229
* make iconfont
231230
*/
232231
watchFilesFor.iconfont = [
233-
path.join(srcDir, 'iconfont', '*.svg'),
234-
path.join(srcDir, 'iconfont', 'template.*')
232+
path.join(srcDir, 'iconfont', '*.svg')
235233
];
236234
gulp.task('iconfont', function(){
237235
var fontName = 'iconfont';
@@ -240,7 +238,7 @@ gulp.task('iconfont', function(){
240238
.pipe(iconfontCss({
241239
fontName: fontName,
242240
path: path.join(srcDir, 'iconfont', 'template.less'),
243-
targetPath: path.join('..', '..', '..', 'src', 'less', 'iconfont.less'), // must be relative to the path used in gulp.dest()
241+
targetPath: path.join('..', '..', '..', 'src', 'less', 'fonts', 'iconfont.less'), // must be relative to the path used in gulp.dest()
244242
fontPath: 'fonts/'
245243
}))
246244
.pipe(iconfont({
@@ -265,8 +263,7 @@ gulp.task('iconfont', function(){
265263
* make iconfont preview
266264
*/
267265
watchFilesFor['iconfont-preview'] = [
268-
path.join(srcDir, 'iconfont', '*.svg'),
269-
path.join(srcDir, 'iconfont', 'template.*')
266+
path.join(srcDir, 'iconfont', '*.svg')
270267
];
271268
gulp.task('iconfont-preview', function(){
272269
var fontName = 'iconfont';
@@ -275,13 +272,13 @@ gulp.task('iconfont-preview', function(){
275272
.pipe(iconfontCss({
276273
fontName: fontName,
277274
path: path.join(srcDir, 'iconfont', 'template.css'),
278-
targetPath: path.join('iconfont.css'), // must be relative to the path used in gulp.dest()
275+
targetPath: fontName + '.css',
279276
fontPath: 'fonts/'
280277
}))
281278
.pipe(iconfontTemplate({
282279
fontName: fontName,
283280
path: path.join(srcDir, 'iconfont', 'template.html'),
284-
targetPath: 'iconfont.html',
281+
targetPath: fontName + '.html',
285282
}))
286283
.pipe(gulpIgnore.exclude('*.svg'))
287284
.pipe(gulp.dest(destDirFont))

0 commit comments

Comments
 (0)