Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

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: 20 days ago
JSON representation

Tree shackable SVG aliases for JSX

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