-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathgulpfile.js
83 lines (74 loc) · 2.21 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
72
73
74
75
76
77
78
79
80
81
82
83
const gulp = require("gulp");
// const sass = require("gulp-sass");
// const sourcemaps = require("gulp-sourcemaps");
const rename = require("gulp-rename");
// const babel = require('gulp-babel');
const uglify = require("gulp-uglify");
const minify = require("gulp-minify");
const cssmin = require("gulp-clean-css");
const concat = require("gulp-concat"); // 여러 js 병합
const concatCss = require("gulp-concat-css"); // 여러 css 병합
const urlAdjuster_mc = require("gulp-css-url-adjuster");
// const webserver = require("gulp-webserver");
const imgDomain_mc ="https:/\//kimkee.gitlab.io/ui" ;
// const imgDomain_mc ="/\//10.120.160.172:8081" ;
const css_mc = [
"static/css/jquery-ui.css",
"static/css/swiper.css",
"static/css/base.css",
"static/css/common.css",
];
const js_mc = [
"static/js/iscroll.js",
"static/js/swiper.js",
"static/js/moment.js",
"static/js/circle-progress.js",
"static/js/pullToRefresh.js",
"static/js/ui.js",
];
const inc_mc = [
"static/src/inc",
];
function styles() {
var d = new Date();
var css_ver = d.getFullYear() +"_"+ (d.getMonth()+1) +"_"+ d.getDate() +"_"+ d.getHours() +"_"+ d.getMinutes() +"_"+ d.getSeconds();
return gulp.src(css_mc)
.pipe(urlAdjuster_mc({
replace: ["../img/","/static/img/"],
prepend: imgDomain_mc+"",
append: "?v="+css_ver
}))
//.pipe(cssmin())
.pipe(concatCss("style.min.css"))
.pipe(cssmin({debug: true /* ,format: 'keep-breaks' */}, function(details) {
console.log(details.name + ' : ' + details.stats.originalSize +' > '+ details.stats.minifiedSize);
}))
.pipe(gulp.dest("static/dist/css/"))
.on('end', function(e) {
console.log("CSS완료");
});
}
function scripts(){
return gulp.src(js_mc)
.pipe(concat('bundle.js'))
.pipe(minify({
ext:{
src:'.js',
min:'.min.js'
},
}))
.pipe(gulp.dest('static/dist/js/'))
.on('end', function() {
console.log("JS완료");
});
}
function includes(){
console.log();
}
function watchers() {
gulp.watch(css_mc, styles);
gulp.watch(js_mc, scripts);
// gulp.watch(inc_mc, includes);
}
const build = gulp.series(styles , scripts , gulp.parallel(watchers));
exports.default = build;