@tabula/svgr-config
v0.3.2
Published
Configuration for the SVGR with ability to change name and display name of components
Downloads
1
Maintainers
Readme
@tabula/svgr-config
Configuration for the SVGR which extends default behaviour:
- forces memoization;
- allows to rename exported name;
- adds display name for memoized component.
It developed to use with @tabula/forge
package, but you can use it on your own risks with your vanilla configuration.
Installation
Use the package manager pnpm to install @tabula/svgr-config
.
pnpm add @tabula/svgr-config --save-dev
Usage
Add the .svgrrc.js
file to the root:
import { defineConfig } from '@tabula/svgr-config';
export default defineConfig({
scope: 'my-awesome-scope',
transformName(name) {
return `Ui${name.slice(3)}`;
},
});
For example, you have comma.svg
filename, and apply SVGR to it. Results will be following with configuration from
above example:
- name of component will be
UiComma
instead ofSvgComma
; - display name of memoized component will be
my-awesome-scope(UiComma)
.
Scoping are helpful in combination with React Dev Tools.
License
This project is ISC licensed.