Skip to content

Commit 9f7463a

Browse files
committed
don't remove desc element or symbol elements when optimizing SVGs
1 parent 053804a commit 9f7463a

File tree

1 file changed

+14
-14
lines changed

1 file changed

+14
-14
lines changed

gulp.d/tasks/build.js

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -104,20 +104,20 @@ module.exports = (src, dest, preview) => () => {
104104
.src(['css/site.css', 'css/vendor/*.css'], { ...opts, sourcemaps })
105105
.pipe(postcss((file) => ({ plugins: postcssPlugins, options: { file } }))),
106106
vfs.src('font/*.{ttf,woff*(2)}', opts),
107-
vfs
108-
.src('img/**/*.{gif,ico,jpg,png,svg}', opts)
109-
.pipe(
110-
preview
111-
? through()
112-
: imagemin(
113-
[
114-
imagemin.gifsicle(),
115-
imagemin.jpegtran(),
116-
imagemin.optipng(),
117-
imagemin.svgo({ plugins: [{ removeViewBox: false }] }),
118-
].reduce((accum, it) => (it ? accum.concat(it) : accum), [])
119-
)
120-
),
107+
vfs.src('img/**/*.{gif,ico,jpg,png,svg}', opts).pipe(
108+
preview
109+
? through()
110+
: imagemin(
111+
[
112+
imagemin.gifsicle(),
113+
imagemin.jpegtran(),
114+
imagemin.optipng(),
115+
imagemin.svgo({
116+
plugins: [{ removeUselessDefs: false }, { removeViewBox: false }, { removeDesc: false }],
117+
}),
118+
].reduce((accum, it) => (it ? accum.concat(it) : accum), [])
119+
)
120+
),
121121
vfs.src('helpers/*.js', opts),
122122
vfs.src('layouts/*.hbs', opts),
123123
vfs.src('partials/*.hbs', opts)

0 commit comments

Comments
 (0)