Created
March 6, 2016 01:13
-
-
Save ro31337/446497660da968cf7f92 to your computer and use it in GitHub Desktop.
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 server = require('gulp-server-livereload'); | |
| var clean = require('gulp-rimraf'); | |
| var sequence = require('run-sequence'); | |
| gulp.task('build', function(callback) { | |
| sequence('clean', ['copy-html', 'browserify'], callback); | |
| }); | |
| // Clean dist folder | |
| gulp.task('clean', function() { | |
| return gulp.src('./dist', { | |
| read: false | |
| }).pipe(clean({ | |
| force: true | |
| })); | |
| }); | |
| // copy html files | |
| gulp.task('copy-html', function() { | |
| return gulp // note "return" keyword | |
| .src('./src/**/*.html') // copy everything, including subdirectories | |
| .pipe(gulp.dest('dist')); // to dist folder | |
| }); | |
| // convert React components to be used in the browser | |
| gulp.task('browserify', function() { | |
| // nothing here for now | |
| }); | |
| gulp.task('server', ['build'], function() { | |
| gulp | |
| .src('./dist') // everything from ./dist directory | |
| .pipe(server({ // pipe to server object | |
| livereload: true, // reload when files are changed | |
| open: true // and open the browser | |
| })); | |
| }); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment