-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathgulpfile.js
71 lines (61 loc) · 1.89 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
var gulp = require('gulp');
var uglify = require('gulp-uglify');
var concat = require('gulp-concat');
var browserSync = require('browser-sync').create();
var reload = browserSync.reload;
/* all gulp tasks to build production code */
gulp.task('build-moveHTML', function() {
gulp
.src('*.html')
.pipe(gulp.dest('build'));
});
gulp.task('build-moveCSS', function() {
gulp
.src('css/*.css')
.pipe(gulp.dest('build/css'));
});
gulp.task('build-moveJS', function() {
gulp
.src(['js/modernizr.js', 'js/foundation.min.js'])
.pipe(gulp.dest('build/js'));
});
gulp.task('build-cat-minify-jquery-js', function() {
return gulp.src(['js/jquery.js', 'js/jquery.hotkeys.js'])
.pipe(concat('jquery.min.js'))
.pipe(gulp.dest('js'))
.pipe(uglify())
.pipe(gulp.dest('js'))
.pipe(gulp.dest('build/js'));
});
gulp.task('build-cat-minify-game-js', function() {
return gulp.src(['js/SudokuGame.js', 'js/game.js'])
.pipe(concat('game.min.js'))
.pipe(gulp.dest('js'))
.pipe(uglify())
.pipe(gulp.dest('js'))
.pipe(gulp.dest('build/js'));
});
/* all gulp tasks to make a automated dev enviroment */
gulp.task('dev-cat-min-js', function() {
return gulp.src(['js/SudokuGame.js', 'js/game.js'])
.pipe(concat('game.min.js'))
.pipe(gulp.dest('js'))
.pipe(uglify())
.pipe(gulp.dest('js'))
.pipe(reload({stream: true}));
})
gulp.task('dev-js-watch', ['dev-cat-min-js'], reload);
gulp.task('dev-serve', ['dev-cat-min-js'], function() {
browserSync.init({
server: {
baseDir: "./"
}
});
gulp.watch("*.html").on("change", reload);
gulp.watch("css/*.css").on("change", reload);
gulp.watch("js/*.js", ['dev-js-watch']);
})
/* gulp cli runners */
gulp.task('default', ['build']);
gulp.task('build', ['build-moveHTML', 'build-moveCSS', 'build-moveJS', 'build-cat-minify-jquery-js', 'build-cat-minify-game-js']);
gulp.task('dev', ['dev-serve']);