https://github.com/pascalduez/babel-plugin-jsx-svg
Tree shackable SVG aliases for JSX
https://github.com/pascalduez/babel-plugin-jsx-svg
babel babel-plugin jsx svg
Last synced: 2 months ago
JSON representation
Tree shackable SVG aliases for JSX
- Host: GitHub
- URL: https://github.com/pascalduez/babel-plugin-jsx-svg
- Owner: pascalduez
- License: unlicense
- Created: 2019-01-04T21:52:53.000Z (over 7 years ago)
- Default Branch: master
- Last Pushed: 2019-01-05T12:53:10.000Z (over 7 years ago)
- Last Synced: 2025-03-25T04:59:40.258Z (over 1 year ago)
- Topics: babel, babel-plugin, jsx, svg
- Language: JavaScript
- Size: 76.2 KB
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# babel-plugin-jsx-svg
> Tree shackable SVG aliases for JSX
## Installation
```
npm install babel-plugin-jsx-svg --save-dev
```
or
```
yarn add babel-plugin-jsx-svg --save-dev
```
## Usage
```json
{
"plugins": ["babel-plugin-jsx-svg"]
}
```
```json
{
"plugins": [
[
"babel-plugin-jsx-svg",
{
"packageName": "somelib",
"elementName": "Svg",
"elementProp": "name",
"propertyName": "icon",
"componentPrefix": "Svg"
}
]
]
}
```
## Examples
```js
/* input */
import { Button } from 'somelib';
Click me;
```
```js
/* output */
import { Button } from 'somelib';
import { SvgFoo } from 'somelib';
}>Click me;
```
```js
/* input */
import { Svg } from 'somelib';
;
```
```js
/* output */
import { SvgFoo } from 'somelib';
;
```
## options
### `packageName`
type: `String`
required: `true`
### `elementName`
type: `String`
required: `false`
default: `Svg`
### `elementProp`
type: `String`
required: `false`
default: `name`
### `propertyName`
type: `String`
required: `false`
default: `icon`
### `componentPrefix`
type: `String`
required: `false`
default: `Svg`
## Credits
- [Pascal Duez](https://github.com/pascalduez)
## Licence
babel-plugin-jsx-svg is [unlicensed](http://unlicense.org/).
[postcss]: https://github.com/postcss/postcss
[npm-url]: https://www.npmjs.org/package/babel-plugin-jsx-svg
[npm-image]: http://img.shields.io/npm/v/babel-plugin-jsx-svg.svg?style=flat-square
[travis-url]: https://travis-ci.org/pascalduez/babel-plugin-jsx-svg?branch=master
[travis-image]: http://img.shields.io/travis/pascalduez/babel-plugin-jsx-svg.svg?style=flat-square
[codecov-url]: https://codecov.io/gh/pascalduez/babel-plugin-jsx-svg
[codecov-image]: https://img.shields.io/codecov/c/github/pascalduez/babel-plugin-jsx-svg.svg?style=flat-square
[depstat-url]: https://david-dm.org/pascalduez/babel-plugin-jsx-svg
[depstat-image]: https://david-dm.org/pascalduez/babel-plugin-jsx-svg.svg?style=flat-square
[license-image]: http://img.shields.io/npm/l/babel-plugin-jsx-svg.svg?style=flat-square
[license-url]: UNLICENSE