Security News
Oracle Drags Its Feet in the JavaScript Trademark Dispute
Oracle seeks to dismiss fraud claims in the JavaScript trademark dispute, delaying the case and avoiding questions about its right to the name.
@react-vector-graphics/plugin-assets
Advanced tools
Default code asset loading plugin for react-vector-graphics
@react-vector-graphics/plugin-assets
The plugin works in two stages discovery and storage.
{
"plugins": [
"@react-vector-graphics/plugin-assets",
"@svgr/plugin-svgo",
"@react-vector-graphics/plugin-assets"
],
"options": {
"assets/globPattern": "./assets/*.svg",
"assets/fileExt": "js",
"assets/nameScheme": "PascalCase",
"assets/outputPath": "./components"
}
}
This should be run before any other plugin that relies on having the svg code in the state.
It uses the globPattern
supplied to find matching files and loaded them into the process.
Splitting off a new branch for each discovered file adding it to the state.
{
"componentName": "BarIcon",
"filePath": "./assets/bar.icon.svg"
}
{
"componentName": "FooIcon",
"filePath": "./assets/foo.icon.svg"
}
At the end of all state manipulations, the plugin is the run with the updated state.
Saving each icon in the output folder as well as any componentFiles
that have been added.
Fixed options that do not change through run lifecycle
assets/globPattern
Glob string pattern, see glob
assets/fileExt
The file extension that is used to write the react component file
assets/nameScheme
String reprenting the naming scheme used to tranform the icon filename to a component name
Supported schemes |
---|
camelCase |
PascalCase |
CONSTANT_CASE |
snake_case |
spinal-case |
assets/outputPath
String pointing to final location all react components are stored in.
Mutable context that can be used to pass information between subsequent run stages
componentName
String representing the name of the react component.
NOTE: This is shared with @svgr/plugin-jsx
filePath
String representing the path to the svg file that was discovered
NOTE: This is shared with @svgr/plugin-jsx
assets/componentFiles
Map of file names to content that are associated with the generated components.
If this is a non empty map then a component folder is used instead of a single file.
Example having this in the state
{
"componentName": "FooIcon",
"filePath": "./assets/foo.icon.svg",
"assets/componentFiles": {
"README.md": "# FooIcon"
}
}
Would result in
./components/FooIcon/index.js # svg component code
./components/FooIcon/README.md
FAQs
Default code asset loading plugin for react-vector-graphics
The npm package @react-vector-graphics/plugin-assets receives a total of 51 weekly downloads. As such, @react-vector-graphics/plugin-assets popularity was classified as not popular.
We found that @react-vector-graphics/plugin-assets demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 2 open source maintainers 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
Oracle seeks to dismiss fraud claims in the JavaScript trademark dispute, delaying the case and avoiding questions about its right to the name.
Security News
The Linux Foundation is warning open source developers that compliance with global sanctions is mandatory, highlighting legal risks and restrictions on contributions.
Security News
Maven Central now validates Sigstore signatures, making it easier for developers to verify the provenance of Java packages.