Created
January 16, 2016 06:43
-
-
Save gabebw/4f82dd9b846c9052d3ec to your computer and use it in GitHub Desktop.
React setup
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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')); | |
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// 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