Skip to content

Instantly share code, notes, and snippets.

@gabebw
Created January 16, 2016 06:43
Show Gist options
  • Save gabebw/4f82dd9b846c9052d3ec to your computer and use it in GitHub Desktop.
Save gabebw/4f82dd9b846c9052d3ec to your computer and use it in GitHub Desktop.
React setup
#!/bin/sh
# This goes in bin/setup
npm install --save \
gulp \
browserify \
react \
react-dom \
babelify \
babel-preset-react \
babel-preset-es2015 \
vinyl-source-stream
var gulp = require('gulp');
var browserify = require('browserify');
var babelify = require('babelify');
var source = require('vinyl-source-stream');
gulp.task('default', function () {
return browserify({entries: './main.jsx', extensions: ['.jsx'], debug: true})
.transform('babelify', {presets: ['es2015', 'react']})
.bundle()
.pipe(source('bundle.js'))
.pipe(gulp.dest('dist'));
});
// https://facebook.github.io/react/docs/getting-started.html
var React = require('react');
var ReactDOM = require('react-dom');
ReactDOM.render(
<h1>Hello, world!</h1>,
document.getElementById('example')
);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment