Security News
Introducing the Socket Python SDK
The initial version of the Socket Python SDK is now on PyPI, enabling developers to more easily interact with the Socket REST API in Python projects.
@svgr/babel-preset
Advanced tools
The @svgr/babel-preset package is a Babel preset for transforming SVG icons into React components. This allows developers to import SVG files directly as React components in their projects, facilitating easier manipulation and integration of SVGs within React applications.
SVG to React Component Transformation
This feature allows SVG files to be imported directly as React components. This is useful for developers who want to use SVGs as components without manually converting them. The code shows how an SVG file can be imported and used as a React component.
import ReactComponent from './icon.svg';
Customizable SVG Transformation
Developers can customize how SVGs are transformed into React components. Options such as disabling SVGO optimization or adding a title prop to the SVG can be configured. The code sample demonstrates how to customize the Babel preset configuration for SVG transformation.
{
"presets": [
"@svgr/babel-preset",
{
"icon": true,
"svgo": false,
"titleProp": true
}
]
}
react-svg-loader is similar to @svgr/babel-preset as it also allows importing SVGs as React components. However, it is implemented as a webpack loader rather than a Babel preset, which might suit different project setups.
This plugin provides similar functionality by allowing SVGs to be imported as React components. It differs in that it is a Babel plugin, offering more integration with Babel's ecosystem and possibly differing in configuration and performance characteristics.
npm install --save-dev @svgr/babel-preset
.babelrc
{
"presets": [["@svgr/babel-preset", { "svgProps": { "width": 200 } }]]
}
MIT
FAQs
SVGR preset that apply transformations from config
The npm package @svgr/babel-preset receives a total of 7,855,769 weekly downloads. As such, @svgr/babel-preset popularity was classified as popular.
We found that @svgr/babel-preset 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.
Security News
The initial version of the Socket Python SDK is now on PyPI, enabling developers to more easily interact with the Socket REST API in Python projects.
Security News
Floating dependency ranges in npm can introduce instability and security risks into your project by allowing unverified or incompatible versions to be installed automatically, leading to unpredictable behavior and potential conflicts.
Security News
A new Rust RFC proposes "Trusted Publishing" for Crates.io, introducing short-lived access tokens via OIDC to improve security and reduce risks associated with long-lived API tokens.