Skip to content

Instantly share code, notes, and snippets.

@jdx
Last active August 11, 2016 23:56
Show Gist options
  • Select an option

  • Save jdx/ed39fc5f31b6b6bda336a39799e0f6ed to your computer and use it in GitHub Desktop.

Select an option

Save jdx/ed39fc5f31b6b6bda336a39799e0f6ed to your computer and use it in GitHub Desktop.
Simple React gulp/client.js
'use strict'
const gulp = require('gulp')
const browserify = require('gulp-browserify')
const uglify = require('gulp-uglify')
const rename = require('gulp-rename')
gulp.task('client:build', () => {
return gulp.src('./client/app.jsx')
.pipe(browserify({
transform: ['babelify'],
extensions: ['.jsx']
})).on('error', err => console.error(err.stack))
.pipe(rename('app.js'))
.pipe(gulp.dest('./public'))
})
gulp.task('client:watch', ['client:build'], () => {
gulp.watch('./client/**/*.jsx', ['client:build'])
})
gulp.task('client:minify', ['client:build'], () => {
return gulp.src('public/app.js')
.pipe(uglify())
.pipe(gulp.dest('./public'))
})
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment