1.0.1 • Published 3 years ago

babel-plugin-remove-rn-unused-style v1.0.1

Weekly downloads
-
License
ISC
Repository
-
Last release
3 years ago

babel-plugin-remove-rn-unused-style

Install

npm install --save babel-plugin-remove-rn-unused-style

Usage

// Input
import React from 'react';
import {StyleSheet, Text, View} from 'react-native';

const App = () => {
  return (
    <View style={styles.style1}>
      <Text style={{...styles.style2}}>sectionDescription</Text>
      <Text style={styles.style4}>highlight</Text>
    </View>
  );
};

const styles = StyleSheet.create({
  style1: {
    paddingHorizontal: 24,
  },
  style2: {
    fontWeight: '400',
  },
  // unused styles
  style3: {
    color: 'red',
  },
  style4: {
    fontWeight: '700',
  },
});
export default App;


// Output
import React from 'react';
import {StyleSheet, Text, View} from 'react-native';

const App = () => {
  return (
    <View style={styles.style1}>
      <Text style={{...styles.style2}}>sectionDescription</Text>
      <Text style={styles.style4}>highlight</Text>
    </View>
  );
};

const styles = StyleSheet.create({
  style1: {
    paddingHorizontal: 24,
  },
  style2: {
    fontWeight: '400',
  },
  style3: {
    color: 'red',
  },
  style4: {
    fontWeight: '700',
  },
});
export default App;