Created
November 28, 2014 17:07
-
-
Save davidrichards/dc948e05bfe34bee397a to your computer and use it in GitHub Desktop.
Basic Gulpfile for a React.js + Reflux client application
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 browserify = require('gulp-browserify'); | |
var concat = require('gulp-concat'); | |
var cssMin = require('gulp-css'); | |
var nodeunit = require('gulp-nodeunit'); | |
gulp.task('cssMinfy', function(){ | |
gulp.src('src/**/*.css') | |
.pipe(cssMin()) | |
.pipe(gulp.dest('dist')); | |
}); | |
gulp.task('browserify', function () { | |
gulp.src('src/js/main.js') | |
.pipe(browserify({transform: 'reactify'})) | |
.pipe(concat('main.js')) | |
.pipe(gulp.dest('dist/js')); | |
}); | |
gulp.task('copy', function () { | |
gulp.src('src/index.html') | |
.pipe(gulp.dest('dist')); | |
gulp.src('src/images/*.*') | |
.pipe(gulp.dest('dist/images')); | |
}); | |
gulp.task('default', ['browserify', 'cssMinfy', 'copy']); | |
function swallowError (error) { | |
console.log(error.toString()); | |
this.emit('end'); | |
} | |
gulp.task('test', function () { | |
gulp.src('test/**/*-test.js') | |
.pipe(nodeunit({ | |
reporter: 'minimal' | |
})) | |
.on('error', swallowError); | |
}); | |
gulp.task('watch', function () { | |
gulp.start('test'); | |
gulp.watch('./src/**/*.js', ['test']); | |
gulp.watch('./test/**/*-test.js', ['test']); | |
gulp.start('default'); | |
gulp.watch('src/**/*.*', ['default']); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment