Last active
November 17, 2015 20:59
-
-
Save DWboutin/5206d73b231bae424814 to your computer and use it in GitHub Desktop.
Todo list React tutorial
This file contains hidden or 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 source = require('vinyl-source-stream'); | |
var browserify = require('browserify'); | |
var sourcemaps = require('gulp-sourcemaps'); | |
var uglify = require('gulp-uglify'); | |
var buffer = require('vinyl-buffer'); | |
var babelify = require('babelify'); | |
gulp.task('build', function () { | |
return browserify({entries: './src/client/app.js', extensions: ['.js'], debug: true}) | |
.transform(babelify, {presets: ['es2015', 'react', 'stage-2']}) | |
.bundle() | |
.on('error', function (err) { | |
console.error(err); | |
this.emit('end'); | |
}) | |
.pipe(source('app.min.js')) | |
.pipe(buffer()) | |
.pipe(sourcemaps.init({loadMaps: true})) | |
.pipe(uglify()) | |
.pipe(sourcemaps.write('./')) | |
.pipe(gulp.dest('./public/js')); | |
}); | |
gulp.task('default', ['build']); |
This file contains hidden or 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
<!DOCTYPE html> | |
<html> | |
<head> | |
<meta charset="utf-8" /> | |
<title>React Tutorial</title> | |
</head> | |
<body> | |
<div id="react-app"></div> | |
<script type="text/javascript" src="public/js/app.min.js"></script> | |
</body> | |
</html> |
This file contains hidden or 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
{ | |
"name": "todo-react-tutorial", | |
"version": "0.0.1", | |
"description": "A React tutorial", | |
"main": "index.js", | |
"scripts": { | |
"test": "echo \"Error: no test specified\" && exit 1" | |
}, | |
"author": "Mikael Boutin <[email protected]>", | |
"license": "ISC", | |
"devDependencies": { | |
"babel-preset-es2015": "^6.1.2", | |
"babel-preset-react": "^6.1.2", | |
"babel-preset-stage-2": "^6.1.18", | |
"babel-runtime": "^6.0.14", | |
"babelify": "^7.2.0", | |
"browserify": "^12.0.1", | |
"gulp": "^3.9.0", | |
"gulp-sourcemaps": "^1.6.0", | |
"gulp-uglify": "^1.4.2", | |
"vinyl-buffer": "^1.0.0", | |
"vinyl-source-stream": "^1.1.0" | |
}, | |
"dependencies": { | |
"babel": "^6.0.15", | |
"react": "^0.14.2", | |
"react-dom": "^0.14.2", | |
"react-redux": "^4.0.0", | |
"redux": "^3.0.4" | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment