-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathgulpfile.js
85 lines (74 loc) · 2 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
//gulpfile.js
const gulp = require("gulp");
const minifyCSS = require("gulp-clean-css");
const uglify = require("gulp-uglify");
const rename = require("gulp-rename");
const sass = require("gulp-sass")(require("sass"));
const npmDist = require("gulp-npm-dist");
const sassFiles = "scss/*.scss",
cssDest = "assets/css/";
//compile scss into css
function style() {
return gulp
.src(sassFiles)
.pipe(sass().on("error", sass.logError))
.pipe(gulp.dest(cssDest));
}
//This is for the minify css
async function minifycss() {
return gulp
.src(["assets/css/*.css", "!assets/css/**/*.min.css"])
.pipe(
rename({
suffix: ".min",
})
)
.pipe(minifyCSS())
.pipe(gulp.dest(cssDest));
}
// This is for the minifyjs
// async function minifyjs() {
// return gulp
// .src([
// "assets/js/custom.js",
// "assets/js/app.js",
// "!assets/js/custom.min.js",
// "!assets/js/app.min.js",
// ])
// .pipe(
// rename({
// suffix: ".min",
// })
// )
// .pipe(uglify())
// .pipe(gulp.dest("assets/js"));
// }
// Copy dependencies to ./public/libs/
// Copy dependencies to ./public/libs/
// gulp.task('copy:libs', function() {
// gulp.src(npmDist(), {base:'./node_modules'})
// .pipe(gulp.dest('./src/assets/libs'));
// });
// function copy(callback) {
// return src(npmDist(),{base: './node_modules'})
// .pipe(dest('./assets/libs'));
// callback();
// }
async function copy() {
gulp
.src(npmDist(), {
base: "./node_modules",
})
.pipe(gulp.dest("assets/libs"));
}
async function watch() {
gulp.watch(["scss/**/*.scss"], style);
gulp.watch(["assets/css/style.css"], minifycss);
// gulp.watch(["assets/js/**/*.js", "!assets/js/**/*.min.js"], minifyjs);
}
gulp.task("default", watch);
exports.style = style;
exports.minifycss = minifycss;
// exports.minifyjs = minifyjs;
exports.copy = copy;
exports.watch = watch;