vite-plugin-svg-spritegen 1.4.4 → 1.4.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +3 -3
- package/dist/index.js +1 -1
- package/dist/index.mjs +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -40,10 +40,10 @@ import spriteHref from '~/assets/icons/sprite.svg';
|
|
|
40
40
|
import type { FC, SVGProps } from 'react';
|
|
41
41
|
import type { IconName } from '~/assets/icons/types';
|
|
42
42
|
|
|
43
|
-
export const IconBase: FC<SVGProps<SVGSVGElement> & {
|
|
43
|
+
export const IconBase: FC<SVGProps<SVGSVGElement> & { icon: IconName }> = ({ icon, ...props }) => {
|
|
44
44
|
return (
|
|
45
45
|
<svg {...props}>
|
|
46
|
-
<use href={`${spriteHref}#${
|
|
46
|
+
<use href={`${spriteHref}#${icon}`} />
|
|
47
47
|
</svg>
|
|
48
48
|
);
|
|
49
49
|
};
|
|
@@ -52,5 +52,5 @@ export const IconBase: FC<SVGProps<SVGSVGElement> & { name: IconName }> = ({ nam
|
|
|
52
52
|
### Usage Example
|
|
53
53
|
|
|
54
54
|
```jsx
|
|
55
|
-
<Icon
|
|
55
|
+
<Icon icon="plus" />
|
|
56
56
|
```
|
package/dist/index.js
CHANGED
|
@@ -229,7 +229,7 @@ function svgSpritegen(config) {
|
|
|
229
229
|
},
|
|
230
230
|
moduleParsed(info) {
|
|
231
231
|
if (!isBuild || !stripUnusedResolved.enabled || !srcFilter(info.id) || !info.code) return;
|
|
232
|
-
const matchPattern =
|
|
232
|
+
const matchPattern = new RegExp(stripUnusedResolved.matchPattern, "g");
|
|
233
233
|
const matches = [...info.code.matchAll(matchPattern)].flatMap(
|
|
234
234
|
({ groups }) => (groups == null ? void 0 : groups.icon) ?? []
|
|
235
235
|
);
|
package/dist/index.mjs
CHANGED
|
@@ -227,7 +227,7 @@ function svgSpritegen(config) {
|
|
|
227
227
|
},
|
|
228
228
|
moduleParsed(info) {
|
|
229
229
|
if (!isBuild || !stripUnusedResolved.enabled || !srcFilter(info.id) || !info.code) return;
|
|
230
|
-
const matchPattern =
|
|
230
|
+
const matchPattern = new RegExp(stripUnusedResolved.matchPattern, "g");
|
|
231
231
|
const matches = [...info.code.matchAll(matchPattern)].flatMap(
|
|
232
232
|
({ groups }) => (groups == null ? void 0 : groups.icon) ?? []
|
|
233
233
|
);
|
package/package.json
CHANGED