forked from raffazizzi/variorum
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathgulpfile.js
36 lines (32 loc) · 1018 Bytes
/
gulpfile.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
// Dependencies
const gulp = require('gulp'),
gutil = require('gulp-util'),
connect = require('gulp-connect'),
uglify = require('gulp-uglify');
browserify = require('browserify'),
source = require('vinyl-source-stream'),
babelify = require('babelify'),
// Tasks
gulp.task('build:es6', function() {
return browserify({
entries: './src/js/index.js',
debug: true
})
.transform("babelify", {presets: ['es2015']})
.bundle()
.on('error', function (err) {
gutil.log("Error : " + err.message);
this.emit('end'); // This is needed for the watch task, or it'll hang on error
})
.pipe(source('variorum.js'))
.on('error', gutil.log)
.pipe(gulp.dest('dist/js/'));
});
gulp.task('watch', function() {
gulp.watch('src/js/**/*.js', ['build:es6']);
})
gulp.task('webserver', function() {
connect.server({livereload: true, port: 8888});
});
gulp.task('default', ['build:es6']);
gulp.task('run', ['webserver', 'build:es6', 'watch']);