Skip to content

Commit a6f3311

Browse files
committed
chore: use imagemin-svgo directly to reduce dependencies
1 parent 9ef6b7f commit a6f3311

File tree

4 files changed

+45
-909
lines changed

4 files changed

+45
-909
lines changed

packages/vaadin-lumo-styles/gulpfile.js

Lines changed: 22 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,9 @@
11
import fs from 'fs';
22
import { dest, src, task } from 'gulp';
33
import iconfont from 'gulp-iconfont';
4-
import imagemin, { svgo } from 'gulp-imagemin';
4+
import { gulpPlugin } from 'gulp-plugin-extras';
5+
import imagemin from 'imagemin';
6+
import svgo from 'imagemin-svgo';
57
import svgpath from 'svgpath';
68

79
/**
@@ -55,14 +57,10 @@ function createIconset(folder, filenames, idPrefix = '') {
5557
return output;
5658
}
5759

58-
task('icons', (done) => {
59-
const folder = 'icons/svg/';
60-
let glyphs;
61-
62-
// Optimize the source files
63-
src(`${folder}*.svg`)
64-
.pipe(
65-
imagemin([
60+
function minifySvg() {
61+
return gulpPlugin('gulp-minify-svg', async (file) => {
62+
const data = await imagemin.buffer(file.contents, {
63+
plugins: [
6664
svgo({
6765
floatPrecision: 6,
6866
plugins: [
@@ -82,8 +80,21 @@ task('icons', (done) => {
8280
},
8381
],
8482
}),
85-
]),
86-
)
83+
],
84+
});
85+
86+
file.contents = Buffer.from(data);
87+
return file;
88+
});
89+
}
90+
91+
task('icons', (done) => {
92+
const folder = 'icons/svg/';
93+
let glyphs;
94+
95+
// Optimize the source files
96+
src(`${folder}*.svg`)
97+
.pipe(minifySvg())
8798
.pipe(dest(folder))
8899
.on('finish', () => {
89100
// Generate vaadin-iconset

packages/vaadin-lumo-styles/package.json

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,8 @@
4848
"gulp": "^5.0.1",
4949
"gulp-cli": "^3.1.0",
5050
"gulp-iconfont": "^12.0.0",
51-
"gulp-imagemin": "^9.1.0"
51+
"gulp-plugin-extras": "^1.0.0",
52+
"imagemin": "^9.0.0",
53+
"imagemin-svgo": "^10.0.1"
5254
}
5355
}

packages/vaadin-lumo-styles/vaadin-iconset.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)