This repository was archived by the owner on Dec 23, 2020. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathgulpfile.js
78 lines (65 loc) · 2.07 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
70
71
72
73
74
75
76
77
78
var fs = require('fs')
var del = require('del')
var gulp = require('gulp')
var rename = require('gulp-rename')
var concat = require('gulp-concat')
var uglify = require('gulp-uglify')
var sass = require('gulp-sass')
var sourcemaps = require('gulp-sourcemaps')
var changed = require('gulp-changed')
var webpackStream = require('webpack-stream');
var webpack = require('webpack');
var webpack_config = require('./webpack.config.js');
// first delete build directory
del.sync(['build'])
// gulp.task('scripts', function() {
// // Minify and copy all JavaScript (except vendor scripts)
// // with sourcemaps all the way down
// return gulp.src('js/*.js')
// .pipe(sourcemaps.init())
// .pipe(uglify())
// .pipe(concat('Tone-Editor.min.js'))
// .pipe(sourcemaps.write())
// .pipe(gulp.dest('build'))
// })
gulp.task('webpack', function() {
return webpackStream(webpack_config, webpack)
.pipe(gulp.dest('./build'))
// .pipe(uglify())
// .pipe(rename({
// suffix: '.min'
// }))
// .pipe(gulp.dest('./build/'))
});
// gulp.task('sass', function () {
// return gulp.src('./sass/**/*.sass')
// .pipe(sass().on('error', sass.logError))
// .pipe(gulp.dest('./build'));
// });
// gulp.task('sass:watch', function () {
// gulp.watch('./sass/*.sass', ['sass']);
// });
// Rerun a task when a file changes
gulp.task('watch', function() {
gulp.watch('Tone.Editor/**', ['webpack'])
// gulp.watch('ToneEditor/Utils/*', ['webpack'])
// gulp.watch('ToneEditor/Templates/*', ['webpack'])
// gulp.watch('ToneEditor/libs/*', ['webpack'])
// gulp.watch('ToneEditor/sass/*', ['webpack'])
// gulp.watch('ToneEditor/img/*', ['webpack'])
})
// The default task (called when you run `gulp` from cli)
gulp.task('default', ['watch', 'webpack'])
process.on('uncaughtException', function(error) {
if (error.cause !== undefined) {
console.log(error.cause);
} else {
console.log(error)
}
process.exit(1)
})
// gulp.task('default', function() {
// return gulp.src('src/entry.js')
// .pipe()
// .pipe(gulp.dest('dist/'));
// });