# babel-plugin-jsx-svg-icon-inject

> This plugin that translates this: ```jsx ```

Latest version **1.0.0** (published 2017-01-09) · MIT license · 0 weekly downloads

> **Deprecated.** This package is deprecated.

## Install

```sh
npm install babel-plugin-jsx-svg-icon-inject
pnpm add babel-plugin-jsx-svg-icon-inject
yarn add babel-plugin-jsx-svg-icon-inject
bun add babel-plugin-jsx-svg-icon-inject
```

## Health

**Score 10/100 (F)** — status: deprecated.

Negative: deprecated.

## Facts

| | |
|---|---|
| Version | 1.0.0 |
| Published | 2017-01-09 |
| First published | 2017-01-09 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Node | >=4.0.0 |
| Dependencies | 1 |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 4 |
| Author | FatFisz |
| Maintainers | fatfisz |

## Links

- npm: https://www.npmjs.com/package/babel-plugin-jsx-svg-icon-inject
- Repository: https://github.com/fatfisz/babel-plugin-jsx-icon-inject
- Issues: https://github.com/fatfisz/babel-plugin-jsx-icon-inject/issues
- npm.io page: https://npm.io/package/babel-plugin-jsx-svg-icon-inject

## Dependencies (1)

- [babel-plugin-syntax-jsx](https://npm.io/package/babel-plugin-syntax-jsx.md) ^6.18.0

## Recent versions

- 1.0.0 (latest) — 2017-01-09

## README

# babel-plugin-jsx-svg-icon-inject

This plugin that translates this:
```jsx
<Icon name="eye" />
```

into this:
```jsx
var _iconMarkupEye = require("some-path/eye.svg");

<Icon markup={_iconMarkupEye} />;
```

It does not contain any implementation of the `Icon` component or a loader for the svg icons.

## Usage

Install from the npm and then add this to `.babelrc`:
```json
{
  "plugins": [
    ["jsx-svg-icon-inject", {
      "path": "some-path",
      "tagName": "Icon"
    }]
  ]
}
```

## Options

### `path` (required)

If the path is absolute, it will stay as is in `require`.

If the path is relative (e.g. `./some-path`), it will be resolved using the current working directory, and the path in `require` will be relative wrt the transpiled script.

Else the path is treated as a "package name" and is left as is.

### `tagName` (required)

Only the tags that have this name will be processed.

### `namePropName`
Default: `'name'`

The value of the prop with this name will be used for getting the icon path.

### `markupPropName`
Default: `'markup'`

The value of the prop with this name will be used for setting the icon markup.

## License

Copyright (c) 2017 Rafał Ruciński. Licensed under the MIT license.

---
_Source: https://npm.io/package/babel-plugin-jsx-svg-icon-inject · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
