
Product
Introducing Webhook Events for Alert Changes
Add real-time Socket webhook events to your workflows to automatically receive software supply chain alert changes in real time.
Command line util that converts SVGs from a directory into a single TypeScript file

This module is designed for authors of UI frameworks which aim to provide an SVG Icon library in a tree shakable way.
To make SVGs tree shakeable its a good way to export them as string constants. Of course you don't always want to regenerate all the strings by hand. That's where svg-to-ts comes in.
This library generates a Typescript file with your svg definitons. The file will be generated in the following format:
name and a data property.
Additonally we also optimize the SVG icons with the help of the svgo package. To optimize the SVG we use the following configurations.
The CLI can be used with the tsvg command. This command accepts the following arguments.
| -v | --version | output the version number |
|---|---|---|
| -t | --typeName | name of the generated type (myIcons) |
| -p | --prefix | prefix for the generated svg constants (myIcon) |
| -i | --interfaceName | name for the generated interface (MyIcon) |
| -f | --fileName | file name of the generated file (default: "my-icons") |
| -s | --srcDirectory | name of the source directory (default: ".") |
| -o | --outputDirectory | name of the output directory (default: "./dist") |
| -h | --help | output usage information |
Let's say we have the following four svg files in a inputfiles folder.
We can now run
svg-to-ts.ts -s ./inputfiles -o ./dist -t sampleIcon -i SampleIcon -p sampleIcon
and we end up with the following file in our dist folder.

FAQs
Build amazing svg icon libraries
The npm package svg-to-ts receives a total of 18,610 weekly downloads. As such, svg-to-ts popularity was classified as popular.
We found that svg-to-ts demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Product
Add real-time Socket webhook events to your workflows to automatically receive software supply chain alert changes in real time.

Security News
ENISA has become a CVE Program Root, giving the EU a central authority for coordinating vulnerability reporting, disclosure, and cross-border response.

Product
Socket now scans OpenVSX extensions, giving teams early detection of risky behaviors, hidden capabilities, and supply chain threats in developer tools.