-
Notifications
You must be signed in to change notification settings - Fork 38
/
gulpfile.js
executable file
·64 lines (53 loc) · 1.6 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
var gulp = require("gulp"),
gutil = require("gulp-util"),
uglify = require("gulp-uglify"),
concat = require("gulp-concat"),
connect = require("gulp-connect-php"),
browserSync = require("browser-sync"),
del = require("del"),
rename = require("gulp-rename"),
cache = require("gulp-cache"),
cssnano = require("gulp-cssnano");
gulp.task("log", function() {
gutil.log("== My First Task ==")
});
gulp.task("js", function() {
gulp.src(["public/assests/js/jquery-3.0.0.min.js", "public/assests/js/index.js"])
.pipe(concat("script.js"))
.pipe(rename({ suffix: ".min" }))
.pipe(uglify())
.pipe(gulp.dest("public/dist/js"))
.on("change", browserSync.reload);
});
gulp.task("css", function() {
gulp.src(["public/assests/css/style.css"])
.pipe(concat("style.css"))
.pipe(rename({ suffix: ".min" }))
.pipe(cssnano())
.pipe(gulp.dest("public/dist/css"))
.on("change", browserSync.reload);
});
gulp.task("connect", function() {
connect.server({
hostname: "127.0.0.1",
port: 3000,
base: "."
},function() {
browserSync({
proxy: "127.0.0.1:3000",
port: 8888
});
});
});
gulp.task("watch", function() {
gulp.watch("public/assets/js/*.js", ["js"]);
gulp.watch(["views/*.php"]).on("change", browserSync.reload);
});
// cleaning build process- run clean before deploy and rebuild files again
gulp.task("clean", function() {
return del(["public/dist/js", "public/dist/css"], { force: true });
});
gulp.task("clear", function (done) {
return cache.clearAll(done);
});
gulp.task("default", ["clean","css", "js", "connect", "watch"]);