Skip to content

Commit

Permalink
Expose svgToJSX [publish]
Browse files Browse the repository at this point in the history
  • Loading branch information
ArnaudBarre committed Apr 26, 2022
1 parent b67d11f commit 5568890
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 2 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
@@ -1,5 +1,9 @@
# Changelog

## 0.1.3

Expose svgToJSX for reuse in other build pipelines

## 0.1.2

Use only `load` to skip source maps
Expand Down
2 changes: 1 addition & 1 deletion package.json
@@ -1,7 +1,7 @@
{
"name": "vite-plugin-fast-react-svg",
"description": "Turn SVG into React components, without Babel",
"version": "0.1.2",
"version": "0.1.3",
"license": "MIT",
"author": "Arnaud Barré (https://github.com/ArnaudBarre)",
"main": "dist/index.js",
Expand Down
2 changes: 1 addition & 1 deletion src/index.ts
Expand Up @@ -27,7 +27,7 @@ export default function svgPlugin(): Plugin {
};
}

const svgToJSX = (svg: string) =>
export const svgToJSX = (svg: string) =>
`import React from "react";const ReactComponent = (props) => (${svg
.replace(/\s([a-z-:]*)="[^"]*"/gu, (string, key: string) => {
if (key.startsWith("data-")) return string;
Expand Down

0 comments on commit 5568890

Please sign in to comment.