node package manager

react-native-coffee

react-native-coffee

Setup

  1. Install dependencies via npm:
npm i --save-dev gulp react-native-coffee
 
  1. Create a Gulpfile.coffee
gulp = require 'gulp'
require 'react-native-coffee'
 
gulp.task 'default'['watch']
  1. Delete index.ios.js

  2. Create index.ios.coffee. Put your app in there.

  3. Run gulp to bootstrap your compilation.

  4. From now on, after you run react-native run-ios, run gulp. Coffeescript should ensue each time you make a change to your .coffee files.

Why

Most approaches to adding Coffeescript to React Native require you to do some kind of boilerplate setup where you clone someone's project and then make your modifications to that.

This approach has some drawbacks, including:

  • clunky to change lots of minor things that the boilerplate includes (source control bindings, authors, project names)
  • difficult to update/upgrade as upstream dependencies change

This package makes it a litle simpler to add turnkey coffeescript compilation to a React Native project, assuming you don't want to modify the build process much.

Thanks to ReactNativeCoffee for inspiration/code samples

Todo

  • Add support for Android