Skip to content

Commit 0dd564c

Browse files
committed
Also flatten rectangles with rounded corners
Add a custom plugin to convert rectangles with rounded corners to paths. Hopefully, this may be removed when svg/svgo#1963 or another similar PR is merged in SVGO.
1 parent c4307a7 commit 0dd564c

File tree

6 files changed

+79
-204
lines changed

6 files changed

+79
-204
lines changed

packages/lucide-preact/tests/__snapshots__/lucide-preact.spec.tsx.snap

Lines changed: 3 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -12,14 +12,7 @@ exports[`Using lucide icon components > should adjust the size, stroke color and
1212
stroke-linejoin="round"
1313
class="lucide lucide-grid3x3"
1414
>
15-
<rect width="18"
16-
height="18"
17-
x="3"
18-
y="3"
19-
rx="2"
20-
>
21-
</rect>
22-
<path d="M3 9h18M3 15h18M9 3v18M15 3v18">
15+
<path d="M5 3h14a2 2 0 0 1 2 2v14a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2zM3 9h18M3 15h18M9 3v18M15 3v18">
2316
</path>
2417
</svg>
2518
`;
@@ -36,14 +29,7 @@ exports[`Using lucide icon components > should not scale the strokeWidth when ab
3629
stroke-linejoin="round"
3730
class="lucide lucide-grid3x3"
3831
>
39-
<rect width="18"
40-
height="18"
41-
x="3"
42-
y="3"
43-
rx="2"
44-
>
45-
</rect>
46-
<path d="M3 9h18M3 15h18M9 3v18M15 3v18">
32+
<path d="M5 3h14a2 2 0 0 1 2 2v14a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2zM3 9h18M3 15h18M9 3v18M15 3v18">
4733
</path>
4834
</svg>
4935
`;
@@ -60,14 +46,7 @@ exports[`Using lucide icon components > should render an component 1`] = `
6046
stroke-linejoin="round"
6147
class="lucide lucide-grid3x3"
6248
>
63-
<rect width="18"
64-
height="18"
65-
x="3"
66-
y="3"
67-
rx="2"
68-
>
69-
</rect>
70-
<path d="M3 9h18M3 15h18M9 3v18M15 3v18">
49+
<path d="M5 3h14a2 2 0 0 1 2 2v14a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2zM3 9h18M3 15h18M9 3v18M15 3v18">
7150
</path>
7251
</svg>
7352
`;

packages/lucide-react-native/tests/__snapshots__/lucide-react-native.spec.tsx.snap

Lines changed: 9 additions & 117 deletions
Original file line numberDiff line numberDiff line change
@@ -11,24 +11,12 @@ exports[`Using lucide icon components > should adjust the size, stroke color and
1111
stroke-linecap="round"
1212
stroke-linejoin="round"
1313
>
14-
<rect fill="none"
15-
stroke="red"
16-
stroke-width="4"
17-
stroke-linecap="round"
18-
stroke-linejoin="round"
19-
width="18"
20-
height="18"
21-
x="3"
22-
y="3"
23-
rx="2"
24-
>
25-
</rect>
2614
<path fill="none"
2715
stroke="red"
2816
stroke-width="4"
2917
stroke-linecap="round"
3018
stroke-linejoin="round"
31-
d="M3 9h18M3 15h18M9 3v18M15 3v18"
19+
d="M5 3h14a2 2 0 0 1 2 2v14a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2zM3 9h18M3 15h18M9 3v18M15 3v18"
3220
>
3321
</path>
3422
</svg>
@@ -46,24 +34,12 @@ exports[`Using lucide icon components > should duplicate properties to children
4634
stroke-linejoin="round"
4735
data-testid="multiple-children"
4836
>
49-
<rect fill="red"
50-
stroke="white"
51-
stroke-width="10"
52-
stroke-linecap="round"
53-
stroke-linejoin="round"
54-
width="18"
55-
height="18"
56-
x="3"
57-
y="3"
58-
rx="2"
59-
>
60-
</rect>
6137
<path fill="red"
6238
stroke="white"
6339
stroke-width="10"
6440
stroke-linecap="round"
6541
stroke-linejoin="round"
66-
d="M3 9h18M3 15h18M9 3v18M15 3v18"
42+
d="M5 3h14a2 2 0 0 1 2 2v14a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2zM3 9h18M3 15h18M9 3v18M15 3v18"
6743
>
6844
</path>
6945
</svg>
@@ -80,24 +56,12 @@ exports[`Using lucide icon components > should not scale the strokeWidth when ab
8056
stroke-linecap="round"
8157
stroke-linejoin="round"
8258
>
83-
<rect fill="none"
84-
stroke="red"
85-
stroke-width="1"
86-
stroke-linecap="round"
87-
stroke-linejoin="round"
88-
width="18"
89-
height="18"
90-
x="3"
91-
y="3"
92-
rx="2"
93-
>
94-
</rect>
9559
<path fill="none"
9660
stroke="red"
9761
stroke-width="1"
9862
stroke-linecap="round"
9963
stroke-linejoin="round"
100-
d="M3 9h18M3 15h18M9 3v18M15 3v18"
64+
d="M5 3h14a2 2 0 0 1 2 2v14a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2zM3 9h18M3 15h18M9 3v18M15 3v18"
10165
>
10266
</path>
10367
</svg>
@@ -114,24 +78,12 @@ exports[`Using lucide icon components > should render an component 1`] = `
11478
stroke-linecap="round"
11579
stroke-linejoin="round"
11680
>
117-
<rect fill="none"
118-
stroke="currentColor"
119-
stroke-width="2"
120-
stroke-linecap="round"
121-
stroke-linejoin="round"
122-
width="18"
123-
height="18"
124-
x="3"
125-
y="3"
126-
rx="2"
127-
>
128-
</rect>
12981
<path fill="none"
13082
stroke="currentColor"
13183
stroke-width="2"
13284
stroke-linecap="round"
13385
stroke-linejoin="round"
134-
d="M3 9h18M3 15h18M9 3v18M15 3v18"
86+
d="M5 3h14a2 2 0 0 1 2 2v14a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2zM3 9h18M3 15h18M9 3v18M15 3v18"
13587
>
13688
</path>
13789
</svg>
@@ -149,24 +101,12 @@ exports[`Using lucide icon components > should work with a single child componen
149101
stroke-linejoin="round"
150102
data-testid="single-child"
151103
>
152-
<rect fill="none"
153-
stroke="currentColor"
154-
stroke-width="2"
155-
stroke-linecap="round"
156-
stroke-linejoin="round"
157-
width="18"
158-
height="18"
159-
x="3"
160-
y="3"
161-
rx="2"
162-
>
163-
</rect>
164104
<path fill="none"
165105
stroke="currentColor"
166106
stroke-width="2"
167107
stroke-linecap="round"
168108
stroke-linejoin="round"
169-
d="M3 9h18M3 15h18M9 3v18M15 3v18"
109+
d="M5 3h14a2 2 0 0 1 2 2v14a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2zM3 9h18M3 15h18M9 3v18M15 3v18"
170110
>
171111
</path>
172112
<svg xmlns="http://www.w3.org/2000/svg"
@@ -180,24 +120,12 @@ exports[`Using lucide icon components > should work with a single child componen
180120
stroke-linejoin="round"
181121
data-testid="child"
182122
>
183-
<rect fill="none"
184-
stroke="currentColor"
185-
stroke-width="2"
186-
stroke-linecap="round"
187-
stroke-linejoin="round"
188-
width="18"
189-
height="18"
190-
x="3"
191-
y="3"
192-
rx="2"
193-
>
194-
</rect>
195123
<path fill="none"
196124
stroke="currentColor"
197125
stroke-width="2"
198126
stroke-linecap="round"
199127
stroke-linejoin="round"
200-
d="M3 9h18M3 15h18M9 3v18M15 3v18"
128+
d="M5 3h14a2 2 0 0 1 2 2v14a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2zM3 9h18M3 15h18M9 3v18M15 3v18"
201129
>
202130
</path>
203131
</svg>
@@ -216,24 +144,12 @@ exports[`Using lucide icon components > should work with several children compon
216144
stroke-linejoin="round"
217145
data-testid="multiple-children"
218146
>
219-
<rect fill="none"
220-
stroke="currentColor"
221-
stroke-width="2"
222-
stroke-linecap="round"
223-
stroke-linejoin="round"
224-
width="18"
225-
height="18"
226-
x="3"
227-
y="3"
228-
rx="2"
229-
>
230-
</rect>
231147
<path fill="none"
232148
stroke="currentColor"
233149
stroke-width="2"
234150
stroke-linecap="round"
235151
stroke-linejoin="round"
236-
d="M3 9h18M3 15h18M9 3v18M15 3v18"
152+
d="M5 3h14a2 2 0 0 1 2 2v14a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2zM3 9h18M3 15h18M9 3v18M15 3v18"
237153
>
238154
</path>
239155
<svg xmlns="http://www.w3.org/2000/svg"
@@ -247,24 +163,12 @@ exports[`Using lucide icon components > should work with several children compon
247163
stroke-linejoin="round"
248164
data-testid="child1"
249165
>
250-
<rect fill="none"
251-
stroke="currentColor"
252-
stroke-width="2"
253-
stroke-linecap="round"
254-
stroke-linejoin="round"
255-
width="18"
256-
height="18"
257-
x="3"
258-
y="3"
259-
rx="2"
260-
>
261-
</rect>
262166
<path fill="none"
263167
stroke="currentColor"
264168
stroke-width="2"
265169
stroke-linecap="round"
266170
stroke-linejoin="round"
267-
d="M3 9h18M3 15h18M9 3v18M15 3v18"
171+
d="M5 3h14a2 2 0 0 1 2 2v14a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2zM3 9h18M3 15h18M9 3v18M15 3v18"
268172
>
269173
</path>
270174
</svg>
@@ -279,24 +183,12 @@ exports[`Using lucide icon components > should work with several children compon
279183
stroke-linejoin="round"
280184
data-testid="child2"
281185
>
282-
<rect fill="none"
283-
stroke="currentColor"
284-
stroke-width="2"
285-
stroke-linecap="round"
286-
stroke-linejoin="round"
287-
width="18"
288-
height="18"
289-
x="3"
290-
y="3"
291-
rx="2"
292-
>
293-
</rect>
294186
<path fill="none"
295187
stroke="currentColor"
296188
stroke-width="2"
297189
stroke-linecap="round"
298190
stroke-linejoin="round"
299-
d="M3 9h18M3 15h18M9 3v18M15 3v18"
191+
d="M5 3h14a2 2 0 0 1 2 2v14a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2zM3 9h18M3 15h18M9 3v18M15 3v18"
300192
>
301193
</path>
302194
</svg>

packages/lucide-react/tests/__snapshots__/lucide-react.spec.tsx.snap

Lines changed: 3 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -12,14 +12,7 @@ exports[`Using lucide icon components > should adjust the size, stroke color and
1212
stroke-linejoin="round"
1313
class="lucide lucide-grid3x3"
1414
>
15-
<rect width="18"
16-
height="18"
17-
x="3"
18-
y="3"
19-
rx="2"
20-
>
21-
</rect>
22-
<path d="M3 9h18M3 15h18M9 3v18M15 3v18">
15+
<path d="M5 3h14a2 2 0 0 1 2 2v14a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2zM3 9h18M3 15h18M9 3v18M15 3v18">
2316
</path>
2417
</svg>
2518
`;
@@ -36,14 +29,7 @@ exports[`Using lucide icon components > should not scale the strokeWidth when ab
3629
stroke-linejoin="round"
3730
class="lucide lucide-grid3x3"
3831
>
39-
<rect width="18"
40-
height="18"
41-
x="3"
42-
y="3"
43-
rx="2"
44-
>
45-
</rect>
46-
<path d="M3 9h18M3 15h18M9 3v18M15 3v18">
32+
<path d="M5 3h14a2 2 0 0 1 2 2v14a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2zM3 9h18M3 15h18M9 3v18M15 3v18">
4733
</path>
4834
</svg>
4935
`;
@@ -60,14 +46,7 @@ exports[`Using lucide icon components > should render an component 1`] = `
6046
stroke-linejoin="round"
6147
class="lucide lucide-grid3x3"
6248
>
63-
<rect width="18"
64-
height="18"
65-
x="3"
66-
y="3"
67-
rx="2"
68-
>
69-
</rect>
70-
<path d="M3 9h18M3 15h18M9 3v18M15 3v18">
49+
<path d="M5 3h14a2 2 0 0 1 2 2v14a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2zM3 9h18M3 15h18M9 3v18M15 3v18">
7150
</path>
7251
</svg>
7352
`;

packages/lucide-solid/tests/__snapshots__/lucide-solid.spec.tsx.snap

Lines changed: 6 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -13,16 +13,8 @@ exports[`Using lucide icon components > should adjust the size, stroke color and
1313
class="lucide lucide-icon lucide-grid3x3"
1414
data-testid="grid-icon"
1515
>
16-
<rect width="18"
17-
height="18"
18-
x="3"
19-
y="3"
20-
rx="2"
21-
key="afitv7"
22-
>
23-
</rect>
24-
<path d="M3 9h18M3 15h18M9 3v18M15 3v18"
25-
key="az6gm2"
16+
<path d="M5 3h14a2 2 0 0 1 2 2v14a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2zM3 9h18M3 15h18M9 3v18M15 3v18"
17+
key="1tmsxl"
2618
>
2719
</path>
2820
</svg>
@@ -41,16 +33,8 @@ exports[`Using lucide icon components > should not scale the strokeWidth when ab
4133
class="lucide lucide-icon lucide-grid3x3"
4234
data-testid="grid-icon"
4335
>
44-
<rect width="18"
45-
height="18"
46-
x="3"
47-
y="3"
48-
rx="2"
49-
key="afitv7"
50-
>
51-
</rect>
52-
<path d="M3 9h18M3 15h18M9 3v18M15 3v18"
53-
key="az6gm2"
36+
<path d="M5 3h14a2 2 0 0 1 2 2v14a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2zM3 9h18M3 15h18M9 3v18M15 3v18"
37+
key="1tmsxl"
5438
>
5539
</path>
5640
</svg>
@@ -68,16 +52,8 @@ exports[`Using lucide icon components > should render a component 1`] = `
6852
stroke-width="2"
6953
class="lucide lucide-icon lucide-grid3x3"
7054
>
71-
<rect width="18"
72-
height="18"
73-
x="3"
74-
y="3"
75-
rx="2"
76-
key="afitv7"
77-
>
78-
</rect>
79-
<path d="M3 9h18M3 15h18M9 3v18M15 3v18"
80-
key="az6gm2"
55+
<path d="M5 3h14a2 2 0 0 1 2 2v14a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2zM3 9h18M3 15h18M9 3v18M15 3v18"
56+
key="1tmsxl"
8157
>
8258
</path>
8359
</svg>

0 commit comments

Comments
 (0)