Created
May 31, 2016 20:04
-
-
Save rheajt/e08fd0230d604f80a97050b0cf21cf99 to your computer and use it in GitHub Desktop.
basic gulpfile
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
//My first attempt at creating a gulpfile. | |
//npm install --save-dev gulp gulp-connect gulp-sass gulp-babel babel-preset-react babel-preset-es2015 | |
//run with 'gulp' | |
var gulp = require('gulp'), | |
connect = require('gulp-connect'), | |
babel = require('gulp-babel'), | |
sass = require('gulp-sass'); | |
gulp.task('default', ['babel', 'sass', 'connect', 'watch']); | |
gulp.task('watch', function() { | |
gulp.watch('src/sass/*.sass', ['sass']); | |
gulp.watch('src/js/*.js', ['babel']); | |
}); | |
gulp.task('babel', function() { | |
return gulp.src('src/js/*.js') | |
.pipe(babel({presets: ['react', 'es2015']})) | |
.pipe(gulp.dest('dist/js')) | |
.pipe(connect.reload()); | |
}); | |
gulp.task('sass', function() { | |
return gulp.src('src/sass/*.sass') | |
.pipe(sass()) | |
.pipe(gulp.dest('dist/css')) | |
.pipe(connect.reload()); | |
}); | |
gulp.task('connect', function() { | |
connect.server({ | |
livereload: true | |
}); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment