-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathgulpfile.js
More file actions
43 lines (36 loc) · 1.05 KB
/
gulpfile.js
File metadata and controls
43 lines (36 loc) · 1.05 KB
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
"use strict";
var fs = require('fs');
var path = require('path');
var gulp = require('gulp');
var rename = require('gulp-rename');
var uglify = require('gulp-uglify');
var webpack = require('webpack-stream');
/* Set constant variables */
const SRC_PATH = 'src/';
const SRC_MAIN = 'Main.js';
const DIST_NAME = 'VirtualGF.js';
const WEBPACK_OPTS = {
target: 'web',
output: { filename: '[name].js' }
};
/* We don't want the watch event to fire
* on temporary files created by editors */
const WATCH_IGNORE = [
'!' + SRC_PATH + '/**/~*',
'!' + SRC_PATH + '/**/.*̈́',
'!' + SRC_PATH + '/**/*.sw?'
];
gulp.task('build', function() {
return gulp.src(SRC_PATH + SRC_MAIN)
.pipe( webpack(WEBPACK_OPTS) )
.pipe( rename({ basename: DIST_NAME, extname: '' }) )
.pipe( gulp.dest('') )
.pipe( uglify() )
.pipe( rename({ extname: '.min.js' }) )
.pipe( gulp.dest('') );
});
gulp.task('watch', function() {
gulp.watch([SRC_PATH + '/**', ...WATCH_IGNORE], ['build']);
});
/* Default gulp task is build, followed by watch */
gulp.task('default', ['build', 'watch']);