forked from XYooo/menu-selector
-
Notifications
You must be signed in to change notification settings - Fork 0
/
gulpfile.js
63 lines (55 loc) · 1.39 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
// dependency
var colors = require("colors/safe");
// var util = require("./util");
var path = require("path");
var shelljs = require("shelljs");
// gulp & gulp plugin
var gulp = require("gulp");
var babel = require("gulp-babel");
var less = require("gulp-less");
var es3ify = require("gulp-es3ify");
colors.setTheme({
silly: 'rainbow',
input: 'grey',
verbose: 'cyan',
prompt: 'grey',
info: 'green',
data: 'grey',
help: 'cyan',
warn: 'yellow',
debug: 'blue',
error: 'red'
});
var getFromCwd = function() {
var args = [].slice.call(arguments, 0);
args.unshift(process.cwd());
return path.join.apply(path, args);
};
gulp.task("pack_lib2", function(cb) {
console.log(colors.info("###### pack_lib2 start ######"));
gulp
.src([
path.join(process.cwd(), "./src/**/*.js"),
])
.pipe(babel())
.pipe(es3ify())
.pipe(gulp.dest("lib/"))
.on("end", function() {
console.log(colors.info("###### pack_lib2 done ######"));
cb();
});
});
gulp.task("less_component",function() {
gulp
.src([
path.join(process.cwd(), "./src/**/*.less"),
])
// .pipe(less())
.pipe(gulp.dest("./lib"));
console.log("###### less_component done ######");
});
gulp.task("clean_lib2", function() {
return shelljs.rm("-rf", getFromCwd("lib"));
});
gulp.task("lib2", ["clean_lib2","pack_lib2"], function() {});
gulp.task('default',['lib2',"less_component"]);