export-svg-typescript 0.1.6 → 0.1.7

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.
@@ -35,7 +35,9 @@ export function convertSVGFolderToExportIndex(inputFolder, indexPath) {
35
35
  const defaultWidth = widthMatch ? widthMatch[1] : "100";
36
36
  const defaultHeight = heightMatch ? heightMatch[1] : "100";
37
37
 
38
- // Convert SVG string to Base64
38
+ if (!widthMatch.length)
39
+ svgContent = svgContent.replace('<svg', '<svg width="100" height="100"')
40
+ // Convert SVG string to Base64
39
41
  const svgBase64 = `data:image/svg+xml;base64,${btoa(
40
42
  unescape(encodeURIComponent(svgContent))
41
43
  )}`;
@@ -114,7 +116,7 @@ function customSVG( options: LoadingOptions, svgString: string) {
114
116
  });
115
117
  }
116
118
  if (!raw)
117
- svgString = \`<img alt="icon" src="data:image/svg+xml;utf8,\${encodeURIComponent(svgString)}" />\`
119
+ svgString = \`<img width="\${finalWidth}" height="\${finalHeight}" alt="icon" src="data:image/svg+xml;utf8,\${encodeURIComponent(svgString)}" />\`
118
120
 
119
121
  return svgString;
120
122
  }
package/package.json CHANGED
@@ -3,7 +3,7 @@
3
3
  "module": "export-svg-typescript.js",
4
4
  "author": "vtempest",
5
5
  "license": "MIT",
6
- "version": "0.1.6",
6
+ "version": "0.1.7",
7
7
  "description": "Export SVG to TypeScript",
8
8
  "type": "module",
9
9
  "scripts": {
package/readme.md CHANGED
@@ -1,3 +1,22 @@
1
+ <p align="center">
2
+ <img src="https://i.imgur.com/LkLbPYE.png" />
3
+ </p>
4
+ <p align="center">
5
+ <a href="https://github.com/vtempest/export-svg-typescript/discussions">
6
+ <img alt="GitHub Stars" src="https://img.shields.io/github/stars/vtempest/export-svg-typescript" /></a>
7
+ <a href="https://npmjs.org/package/export-svg-typescript">
8
+ <img alt="NPM Version" src="https://img.shields.io/npm/v/export-svg-typescript" />
9
+ </a>
10
+ <img src="https://img.shields.io/github/last-commit/vtempest/export-svg-typescript.svg?style=flat-square" alt="GitHub last commit" />
11
+ <a href="https://github.com/vtempest/export-svg-typescript/discussions">
12
+ <img alt="GitHub Discussions"
13
+ src="https://img.shields.io/github/discussions/vtempest/export-svg-typescript" />
14
+ </a>
15
+ <a href="http://makeapullrequest.com">
16
+ <img src="https://img.shields.io/badge/PRs-welcome-brightgreen.svg?style=flat-square" alt="PRs Welcome"/>
17
+ </a>
18
+ </p>
19
+
1
20
  ## export-svg-typescript
2
21
 
3
22
  Convert a folder of SVG icons into a color-customizable, tree-shakable TypeScript export `index.ts` that works with any component framework without SVG or Vite compiler issues.