forked from leochan2017/kms-jsmind
-
Notifications
You must be signed in to change notification settings - Fork 0
/
gulpfile.js
63 lines (50 loc) · 1.27 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
var gulp = require('gulp');
var minifycss = require('gulp-minify-css');
var uglify = require('gulp-uglify');
var rename = require('gulp-rename');
var clean = require('gulp-clean');
var notify = require("gulp-notify");
var tinylr = require('tiny-lr');
var server = tinylr();
var port = 35729;
var __SRC__ = {
file: './src/',
js: './src/*.js',
css: './src/*.css'
}
var __DST__ = './dist/';
gulp.task('css', function() {
gulp.src(__SRC__.css)
.pipe(minifycss())
.pipe(rename({ suffix: '.min' }))
.pipe(gulp.dest(__DST__))
.pipe(notify('css task is finish'));
});
gulp.task('js', function() {
gulp.src(__SRC__.js)
.pipe(uglify())
.pipe(rename({ suffix: '.min' }))
.pipe(gulp.dest(__DST__))
.pipe(notify('js task is finish'));
});
gulp.task('clean', function() {
gulp.src([__DST__], {
read: false
})
.pipe(clean())
.pipe(notify('clean task is finish'));
});
gulp.task('default', ['clean'], function() {
gulp.start('css', 'js');
});
gulp.task('watch', function() {
server.listen(port, function(err) {
if (err) return console.log(err);
gulp.watch(__SRC__.css, function() {
gulp.run('css');
});
gulp.watch(__SRC__.js, function() {
gulp.run('js');
});
});
});