Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
Gulpfile for project
var gulp = require('gulp');
var socketio = require('');
var EE = require('events').EventEmitter;
var react = require('gulp-react');
var io = socketio.listen('3002', function (err, msg) {
if (err) {
io.on('connection', function (socket) {
console.log('a client connected');
socket.on('disconnect', function () {
console.log('a client disconnected');
});'./public/static/app/js/views/**/*.js').on('change', function (file) {
var reconciledPath = reconcilePathForRequireJS(file); //you need to do some work to reconcile RequireJS paths with your front-end app
var ee = transpileJSX();
ee.on('error', function (err) {
io.sockets.emit('.jsx transform error', JSON.stringify(err))
ee.on('end', function () {
io.sockets.emit('hot-reload (.jsx)', reconciledPath);
function transpileJSX() {
var ee = new EE();
.pipe(react({harmony: false})).on('error', function (err) { //we absolutely need error handling, so front-end doesn't croak if we make mistakes writing our JSX
.pipe(gulp.dest('./public/static/app/js/jsx')).on('error', function (err) {
}).on('end', function () {
return ee;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.