# babel-plugin-transform-react-native-style-optimizer

> Optimize inline style attributes in react-native. Removes duplicate style definitions and moves styles to a StyleSheet.

Latest version **0.0.9** (published 2017-01-23) · MIT license · 0 weekly downloads

## Install

```sh
npm install babel-plugin-transform-react-native-style-optimizer
pnpm add babel-plugin-transform-react-native-style-optimizer
yarn add babel-plugin-transform-react-native-style-optimizer
bun add babel-plugin-transform-react-native-style-optimizer
```

## Health

**Score 15/100 (F)** — status: abandoned.

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support; pre 1.0.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 0.0.9 |
| Published | 2017-01-23 |
| First published | 2017-01-16 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 0 |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 9 |
| Author | Jaakko Lukkari |
| Maintainers | orktes |
| Keywords | babel-plugin |

## Links

- npm: https://www.npmjs.com/package/babel-plugin-transform-react-native-style-optimizer
- Repository: https://github.com/orktes/babel-plugin-transform-react-native-style-optimizer
- Homepage: https://github.com/orktes/babel-plugin-transform-react-native-style-optimizer#readme
- Issues: https://github.com/orktes/babel-plugin-transform-react-native-style-optimizer/issues
- npm.io page: https://npm.io/package/babel-plugin-transform-react-native-style-optimizer

## Alternatives

- [@openai/codex-sdk](https://npm.io/package/@openai/codex-sdk.md) — 731.4K weekly downloads
- [babel-plugin-transform-react-jsx](https://npm.io/package/babel-plugin-transform-react-jsx.md) — 565.0K weekly downloads
- [babel-helper-remove-or-void](https://npm.io/package/babel-helper-remove-or-void.md) — 508.5K weekly downloads
- [@pnpm/store-controller-types](https://npm.io/package/@pnpm/store-controller-types.md) — 186.9K weekly downloads
- [react-native-signature-canvas](https://npm.io/package/react-native-signature-canvas.md) — 155.6K weekly downloads

## Recent versions

- 0.0.9 (latest) — 2017-01-23
- 0.0.8 — 2017-01-18
- 0.0.7 — 2017-01-17
- 0.0.6 — 2017-01-17
- 0.0.5 — 2017-01-17
- 0.0.4 — 2017-01-17
- 0.0.3 — 2017-01-16
- 0.0.2 — 2017-01-16
- 0.0.1 — 2017-01-16

## README

# babel-plugin-transform-react-native-style-optimizer
> Optimize inline style attributes in react-native. Removes duplicate style definitions and moves styles to a StyleSheet.

[![Build Status](https://travis-ci.org/orktes/babel-plugin-transform-react-native-style-optimizer.svg?branch=master)](https://travis-ci.org/orktes/babel-plugin-transform-react-native-style-optimizer)

## Example

**In**

```js
<View style={[{ width: 100, height: 100 }]} />;
<View style={[
    { width: 100, height: 200 },
    { height: 100, width: 100 },
    { width: 100, height: 200 },
    { width: 100, height: 100 }
  ]}
/>;
```

**Out**

```js
<View style={[_styles.s0]} />;
<View style={[_styles.s1, _styles.s0]} />;

const _styles = require("react-native").StyleSheet.create({
  s0: { width: 100, height: 100 },
  s1: { width: 100, height: 200 }
});
```
## Installation

```sh
npm install --save-dev babel-plugin-transform-react-native-style-optimizer
```

## Usage

### Via `.babelrc` (Recommended)

**.babelrc**

```json
{
  "plugins": ["transform-react-native-style-optimizer"]
}
```

### Via CLI

```sh
babel --plugins transform-react-native-style-optimizer script.js
```

### Via Node API

```javascript
require("babel-core").transform("code", {
  plugins: ["transform-react-native-style-optimizer"]
});
```

## References

* https://facebook.github.io/react-native/docs/stylesheet.html

---
_Source: https://npm.io/package/babel-plugin-transform-react-native-style-optimizer · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
