Created
October 20, 2016 17:53
-
-
Save AVStarikovich/29617752c1917bea9551815b944db857 to your computer and use it in GitHub Desktop.
new gulpfile
This file contains 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'), | |
connect = require('gulp-connect'), | |
browserify = require('browserify'), | |
source = require('vinyl-source-stream'), | |
livereload = require('gulp-livereload'), | |
babelify = require('babelify'); | |
gulp.task('connect', function() { | |
connect.server({ | |
root: './', | |
fallback: 'index.html', | |
port: 1337, | |
liveReload: true | |
}) | |
}) | |
gulp.task('js', function() { | |
browserify({ | |
entries: [ | |
'node_modules/angular/angular.js', | |
'node_modules/angular-ui-router/release/angular-ui-router.js', | |
'src/js/main.js', | |
'src/js/addRecipe.js', | |
'src/js/recipeInfo.js' | |
] | |
}) | |
.transform(babelify.configure({ | |
presets: 'es2015' | |
})) | |
.bundle() | |
.on('error', function(err) { | |
console.log(err); | |
}) | |
.pipe(source('bundle.js')) | |
.pipe(gulp.dest('')) | |
.pipe(connect.reload()); | |
}) | |
gulp.task('watch', function() { | |
livereload.listen(); | |
gulp.watch(['*.html', 'index.html', 'src/js/*.js', '!bundle.js'], ['js']); | |
}) | |
gulp.task('build', ['js', 'connect'], function(done) { | |
done(); | |
}) | |
gulp.task('default', ['build', 'watch']); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment