-
Notifications
You must be signed in to change notification settings - Fork 0
/
gulpfile.js
53 lines (47 loc) · 1.38 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
/**
* Assets Compil Tasking
*/
// Should included this line to let plugins work
require('babel/register')
var gulp = require('gulp')
var sourcemaps = require('gulp-sourcemaps')
var babel = require('gulp-babel')
var order = require('gulp-order')
var concat = require('gulp-concat')
var uglify = require('gulp-uglify')
var browserSync = require('browser-sync').create()
function handleError(err) {
console.log(err.toString())
this.emit('end')
}
gulp.task('js', function() {
return gulp.src('js/**/*.js')
.pipe(sourcemaps.init())
.pipe(babel({
plugins: ['babel-plugin-class-name']
}))
.on('error', handleError)
.pipe(order([
'js/Core.js',
'js/Assets.js',
'js/Helper.js',
'js/Command.js',
'js/MonsterData.js',
'js/**/*.js',
'js/game.js'
]))
.pipe(concat('game.js'))
.pipe(uglify())
.on('error', handleError)
.pipe(sourcemaps.write('.'))
.pipe(gulp.dest('static/js'))
})
gulp.task('watch', ['js'], function() {
browserSync.init({
proxy: "localhost:5000",
})
gulp.watch(['js/**/*.js'], ['js', browserSync.reload])
gulp.watch(['static/**/*.html'], browserSync.reload)
gulp.watch(['static/img/**/*.{jpg,png}'], browserSync.reload)
gulp.watch(['static/css/**/*.css'], browserSync.reload)
})