-
Notifications
You must be signed in to change notification settings - Fork 2
/
gulpfile.js
58 lines (50 loc) · 1.49 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
/**
* Javascript Task Runner
* @author Alvin Lin ([email protected])
*/
var gulp = require('gulp');
var autoprefixer = require('gulp-autoprefixer');
var concat = require('gulp-concat');
var closure = require('gulp-closure-compiler-service');
var cssnano = require('gulp-cssnano');
var less = require('gulp-less');
var plumber = require('gulp-plumber');
var rename = require('gulp-rename');
gulp.task('default', ['js', 'less']);
gulp.task('js', function() {
return gulp.src(['./shared/*.js',
'./static/js/game/*.js',
'./static/js/*.js'])
.pipe(plumber())
.pipe(concat('minified.js'))
.pipe(closure({
compilation_level: 'SIMPLE_OPTIMIZATIONS'
}))
.pipe(gulp.dest('static/dist'));
});
gulp.task('less', function() {
return gulp.src('./static/less/styles.less')
.pipe(plumber())
.pipe(less({ compress: true}))
.pipe(autoprefixer())
.pipe(cssnano())
.pipe(rename(function(path) {
path.basename = 'minified';
path.extname = '.css';
}))
.pipe(gulp.dest('./static/dist'));
});
gulp.task('watch-js', function() {
gulp.watch(['./shared/*.js',
'./static/js/*.js',
'./static/js/game/*.js'], ['js']);
});
gulp.task('watch-less', function() {
gulp.watch('./static/less/*.less', ['less']);
});
gulp.task('watch', function() {
gulp.watch(['./shared/*.js',
'./static/js/*.js',
'./static/js/game/*.js'], ['js']);
gulp.watch('./static/less/*.less', ['less']);
});