0.0.9 • Published 7 years ago

babel-plugin-transform-react-native-style-optimizer v0.0.9

Weekly downloads
9
License
MIT
Repository
github
Last release
7 years ago

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

Example

In

<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

<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

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

Usage

Via .babelrc (Recommended)

.babelrc

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

Via CLI

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

Via Node API

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

References

0.0.9

7 years ago

0.0.8

7 years ago

0.0.7

7 years ago

0.0.6

7 years ago

0.0.5

7 years ago

0.0.4

7 years ago

0.0.3

7 years ago

0.0.2

7 years ago

0.0.1

7 years ago