This repository has been archived by the owner on Oct 30, 2019. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathgulpfile.js
131 lines (116 loc) · 4.24 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
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
/* global require */
'use strict';
var gulp = require('gulp');
var rimraf = require('gulp-rimraf');
//var watch = require('gulp-watch')
var browserSync = require('browser-sync');
//var reload = browserSync.reload;
var concat = require("gulp-concat");
var babel = require("gulp-babel");
var sourcemaps = require("gulp-sourcemaps");
var uglify = require('gulp-uglify');
var cssmin = require('gulp-cssmin');
//var debug = require('gulp-debug');
var config = {
entryFiles: [
'./src/components/map/core/init.js',
'./src/components/map/core/log.js',
'./src/components/utilities/polyfills.js',
'./src/components/utilities/general.js',
'./src/components/utilities/environment.js',
'./src/components/preloading/Preload.js',
'./src/components/map/core/utils/dataManipulation.js',
'./src/components/map/core/utils/effects.js',
'./src/components/map/core/utils/utils.js',
'./src/components/map/core/mapAPI.js',
'./src/components/map/core/mapEvents.js',
'./src/components/map/core/eventlisteners.js',
'./src/components/map/core/MapLayers.js',
'./src/components/map/core/MapDataManipulator.js',
'./src/components/map/core/UI.js',
'./src/components/map/core/ObjectManager.js',
'./src/components/map/core/Objects.js',
'./src/components/map/core/Sound.js',
'./src/components/map/core/mapStates.js',
'./src/components/map/core/UI.js',
'./src/components/map/core/UITemplateBase.js',
'./src/components/map/core/baseEventlisteners/*.js',
'./src/components/map/core/move/*.js',
'./src/components/map/core/zoom/*.js',
'./src/components/map/extensions/basicActions/*.js',
'./src/components/map/extensions/hexagons/init.js',
'./src/components/map/extensions/hexagons/utils/hexagonMath.js',
'./src/components/map/extensions/hexagons/utils/createHexagon.js',
'./src/components/map/extensions/hexagons/eventListeners/*.js',
'./src/components/map/extensions/hexagons/*.js',
'./src/components/map/extensions/mapMovement/mapMovement.js',
'./src/components/map/UIs/default/init.js',
'./src/components/map/UIs/default/utils/*.js',
'./src/components/map/UIs/default/layout/*.js',
'./src/components/map/UIs/default/default.js',
'./src/components/map/core/Flatworld.js',
'./src/factories/*.js'],
cssFiles: ['./src/assets/lib/pace/css/loadingBar.css'],
outputDir: './dist/',
outputDirDev: './src/dist/',
outputFile: 'flatworld.js'
};
gulp.task('deploy', ['clean', 'bundleLib', 'bundleCss', 'bundleProd']);
gulp.task('build', ['cleanDev', 'bundleLibDev', 'bundleCssDev', 'bundleDev']);
gulp.task('bundleProd', function() {
return gulp.src(config.entryFiles)
.pipe(sourcemaps.init())
.pipe(babel())
.pipe(uglify())
.pipe(concat('flatworld.min.js'))
.pipe(sourcemaps.write("."))
.pipe(gulp.dest(config.outputDir));
});
gulp.task('bundleLib', function() {
return gulp.src('./src/assets/lib/**/*.js', { base: './src/assets/lib/' })
.pipe(concat('flatworld_libraries.js'))
.pipe(gulp.dest(config.outputDir));
});
gulp.task('bundleLibDev', function() {
return gulp.src('./src/assets/lib/**/*.js', { base: './src/assets/lib/' })
.pipe(concat('flatworld_libraries.js'))
.pipe(gulp.dest(config.outputDirDev));
});
gulp.task('bundleDev', function() {
return gulp.src(config.entryFiles)
.pipe(sourcemaps.init())
.pipe(babel())
.pipe(uglify())
.pipe(concat('flatworld.js'))
.pipe(sourcemaps.write("."))
.pipe(gulp.dest(config.outputDirDev));
});
gulp.task('watch', function() {
return gulp.watch(config.entryFiles, ['bundleDev']);
});
gulp.task('cleanDev', function(){
return rimraf(config.outputDirDev);
});
gulp.task('clean', function(){
return rimraf(config.outputDir);
});
gulp.task('bundleCss', function () {
return gulp.src(config.cssFiles)
.pipe(cssmin())
.pipe(concat('flatworld.css'))
.pipe(gulp.dest(config.outputDir + "css/"));
});
gulp.task('bundleCssDev', function () {
return gulp.src(config.cssFiles)
.pipe(concat('flatworld.css'))
.pipe(gulp.dest(config.outputDirDev + "css/"));
});
gulp.task('develope', ['build', 'watch'], function() {
return browserSync({
server: {
baseDir: './src/'
},
startPath: "tests/manualStressTest.html"
});
});
gulp.task('default', ['deploy', 'build']);