-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathgulpfile.js
69 lines (56 loc) · 1.58 KB
/
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
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
var gulp = require('gulp');
var del = require('del');
var connect = require('gulp-connect');
var webpack = require('gulp-webpack');
var webpackConfig = require('./webpack.config.js');
var browserify = require('browserify');
var transform = require('vinyl-transform');
var source = require('vinyl-source-stream');
var port = process.env.PORT || 3000;
var reloadPort = process.env.RELOAD_PORT || 35729;
/*gulp.task('browserify', function () {
var browserified = transform(function(filename) {
var b = browserify(filename);
return b.bundle();
});
return gulp.src(['./js/*.js'])
.pipe(browserified)
.pipe(gulp.dest('./browserified/'));
});
*/
//This worked but needs to be changed
/*
gulp.task('browserify', function() {
return browserify('./js/utils/Editor.js')
.bundle()
//Pass desired output filename to vinyl-source-stream
.pipe(source('editor.js'))
// Start piping stream to tasks!
.pipe(gulp.dest('./browserified/'));
});
*/
gulp.task('clean', function () {
del(['build']);
});
gulp.task('build', function () {
return gulp.src(webpackConfig.entry.app[0])
.pipe(webpack(webpackConfig))
.pipe(gulp.dest('build/'));
});
gulp.task('serve', function () {
connect.server({
port: port,
livereload: {
port: reloadPort
}
});
});
gulp.task('reload-js', function () {
return gulp.src('./build/*.js')
.pipe(connect.reload());
});
gulp.task('watch', function () {
gulp.watch(['./build/*.js'], ['reload-js']);
});
gulp.task('default', ['clean', 'build', 'serve', 'watch']);
//gulp.task('default', ['clean', 'browserify', 'build', 'serve', 'watch']);