-
-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathgulpfile.js
executable file
·50 lines (42 loc) · 1.26 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
var gulp = require('gulp');
var babel = require('gulp-babel');
var plugins = require('gulp-load-plugins')();
gulp.task("clean",function() {
return gulp.src("./public/*")
.pipe(plugins.clean());
});
gulp.task("css",function(){
var stream = gulp.src(["public/**/*.css","!public/**/*.min.css"])
.pipe(plugins.minifyCss({compatibility: 'ie8'}))
.pipe(gulp.dest("./public/"));
return stream;
});
gulp.task("js",function(){
var stream = gulp.src(["public/**/*.js","!public/**/*.min.js"])
.pipe(babel({presets: ['env']}))
.pipe(plugins.uglify())
.pipe(gulp.dest("./public/"));
return stream;
});
gulp.task("html",function(){
var stream = gulp.src("public/**/*.html")
.pipe(plugins.minifyHtml())
//.pipe(plugins.rename({suffix: ".gulp"}))
.pipe(gulp.dest("./public/"));
return stream;
});
gulp.task("mv",["html","css","js"],function() {
var stream = gulp.src("./dst/*")
.pipe(gulp.dest("./public/"));
/*.pipe(plugins.shell([
"cp -r ./dst/* ./public/"
]));
*/
return stream;
});
gulp.task("watch",function() {
gulp.watch("public/*",["optimise"]);
});
gulp.task("default",["html","css","js"],function(){
console.log("gulp task ok!");
});