-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathgulpfile.js
96 lines (80 loc) · 2.4 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
84
85
86
87
88
89
90
91
92
93
94
95
96
var gulp = require("gulp");
var del = require("del");
var concat = require("gulp-concat");
var uglify = require("gulp-uglify");
var uglifycss = require("gulp-uglifycss");
var rename = require("gulp-rename");
var browserSync = require("browser-sync").create();
var config = {
distFolder: "dist"
};
gulp.task("clean", function(done) {
del([config.distFolder]);
done();
});
gulp.task("copy-adp-hide", function() {
return gulp.src([
"src/adp-hide.css"
]).pipe(gulp.dest(config.distFolder));
});
gulp.task("copy-effects", function () {
return gulp.src([
"src/effects/**/*"
]).pipe(gulp.dest(config.distFolder + "/effects"));
});
gulp.task("copy-js", function() {
return gulp.src([
"src/adp.js"
]).pipe(gulp.dest(config.distFolder));
});
gulp.task("copy", gulp.series("copy-adp-hide", "copy-effects", "copy-js"));
gulp.task("concat-css", function () {
return gulp.src([
"src/effects/*",
"src/adp-hide.css"
]).pipe(concat("adp.css"))
.pipe(gulp.dest(config.distFolder));
});
gulp.task("minify-effects", function() {
return gulp.src([
"src/effects/**/*"
]).pipe(uglifycss())
.pipe(rename({ suffix: ".min" }))
.pipe(gulp.dest(config.distFolder + "/effects"));
});
gulp.task("minify-css", function() {
return gulp.src([config.distFolder + "/adp.css", config.distFolder + "/adp-hide.css"])
.pipe(uglifycss())
.pipe(rename({ suffix: ".min" }))
.pipe(gulp.dest(config.distFolder));
});
gulp.task("minify-js", function() {
return gulp.src(config.distFolder + "/adp.js")
.pipe(uglify())
.pipe(rename({ suffix: ".min" }))
.pipe(gulp.dest(config.distFolder));
});
gulp.task("minify", gulp.series("minify-effects", "minify-css", "minify-js"));
// Development related scripts
var browserSyncConfig = {
server: {
baseDir: "./"
},
startPath: "/test/index.html?files=src"
};
gulp.task("browser-sync", function(done) {
browserSync.init(browserSyncConfig);
done();
});
gulp.task("reload", function(done) {
browserSync.reload();
done();
});
gulp.task("test", gulp.series("browser-sync", function () {
var filesToWatch = ["src/**/*", "test/index.html"];
gulp.watch(filesToWatch, gulp.series("reload"));
}));
gulp.task("test:dist", function() {
browserSyncConfig.startPath = "/test/index.html?files=dist";
browserSync.init(browserSyncConfig);
});