Skip to content

Instantly share code, notes, and snippets.

@smilingkylan
Created February 14, 2020 18:59
Show Gist options
  • Save smilingkylan/7a1e0a24b2c77396e6339cf60aa640bb to your computer and use it in GitHub Desktop.
Save smilingkylan/7a1e0a24b2c77396e6339cf60aa640bb to your computer and use it in GitHub Desktop.
Bash create style files from React Native components (Example)
for f in ./*.tsx;
do
FILE=$f
if [ ! -f "../styles/${f%.tsx}Style.ts" ]; then
echo "Processing $f"
cp $f /Users/myUser/src/styles/${f%.tsx}Style.ts
cat /Users/myUser/StyleTemplate.ts > /Users/myUser/src/styles/${f%.tsx}Style.ts
fi
done
import { StyleSheet, Dimensions } from 'react-native'
const { width, height } = Dimensions.get('window')
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment