Last active
August 11, 2016 23:56
-
-
Save jdx/ed39fc5f31b6b6bda336a39799e0f6ed to your computer and use it in GitHub Desktop.
Simple React gulp/client.js
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
| '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