-
Notifications
You must be signed in to change notification settings - Fork 0
/
gulpfile.js
117 lines (99 loc) · 3.31 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
var gulp = require('gulp');
var sass = require('gulp-sass');
var concat = require('gulp-concat');
var uglify = require('gulp-uglify');
var cssmin = require('gulp-cssmin');
var rename = require('gulp-rename');
var eslint = require('gulp-eslint');
var static_dir = 'languagemonster/languagemonster/static/';
var js_dir = static_dir + 'js/';
var js_build_dir = static_dir + 'js_build/';
var js_games_dir = static_dir + 'js/game/';
var css_dir = static_dir + 'css/';
var scss_dir = static_dir + 'scss/';
gulp.task('lint', function() {
return gulp.src([js_dir + '**/*.js', '!' + js_dir + 'build/**/*.js'])
.pipe(eslint())
.pipe(eslint.format());
});
gulp.task('scss_app', function() {
return gulp.src(scss_dir + 'app/*.scss')
.pipe(sass())
.pipe(rename('css.css'))
.pipe(cssmin())
.pipe(rename({suffix: '.min'}))
.pipe(gulp.dest(css_dir + 'app/'));
});
gulp.task('scss_landing', function() {
return gulp.src(scss_dir + 'landing/*.scss')
.pipe(sass())
.pipe(rename('css.css'))
.pipe(cssmin())
.pipe(rename({suffix: '.min'}))
.pipe(gulp.dest(css_dir + 'landing/'));
});
gulp.task('js_games', function() {
return gulp.src([
js_games_dir + 'base.js',
js_games_dir + 'utility.js',
js_games_dir + 'common.js',
js_games_dir + 'easing.js',
js_games_dir + 'tween.js',
js_games_dir + 'key.js',
js_games_dir + 'data_loader.js',
js_games_dir + 'abstract_screen.js',
js_games_dir + 'loading_screen.js',
js_games_dir + 'simple_game.js',
js_games_dir + 'space/main.js',
js_games_dir + 'space/ship.js',
js_games_dir + 'space/interface.js',
js_games_dir + 'plane/main.js',
js_games_dir + 'plane/ship.js',
js_games_dir + 'plane/interface.js',
js_games_dir + 'runner/main.js',
js_games_dir + 'runner/ship.js',
js_games_dir + 'runner/interface.js',
js_games_dir + 'shooter/main.js',
js_games_dir + 'shooter/ship.js',
js_games_dir + 'shooter/interface.js',
js_games_dir + 'game.js'
], {base: js_dir})
.pipe(concat('games.js'))
.pipe(gulp.dest(js_build_dir))
.pipe(rename('games.js'))
.pipe(uglify())
.pipe(rename('games.min.js'))
.pipe(gulp.dest(js_build_dir));
});
gulp.task('js_app', function() {
return gulp.src([
js_dir + 'util.js',
js_dir + 'app/interface.js',
js_dir + 'app/admin.js'
], {base: js_dir})
.pipe(concat('app.js'))
.pipe(gulp.dest(js_build_dir))
.pipe(rename('app.js'))
.pipe(uglify())
.pipe(rename('app.min.js'))
.pipe(gulp.dest(js_build_dir));
});
gulp.task('js_landing', function() {
return gulp.src([
js_dir + 'util.js',
js_dir + 'landing/home.js'
], {base: js_dir})
.pipe(concat('landing.js'))
.pipe(gulp.dest(js_build_dir))
.pipe(rename('landing.js'))
.pipe(uglify())
.pipe(rename('landing.min.js'))
.pipe(gulp.dest(js_build_dir));
});
gulp.task('js', ['js_landing', 'js_app', 'js_games']);
gulp.task('scss', ['scss_landing', 'scss_app']);
gulp.task('watch', function() {
gulp.watch(js_dir + '**/*.js', ['lint', 'js']);
gulp.watch(scss_dir + '**/*.scss', ['scss']);
});
gulp.task('default', ['lint', 'js', 'scss']);