-
Notifications
You must be signed in to change notification settings - Fork 0
/
gulpfile.js
54 lines (49 loc) · 1.53 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
var gulp = require("gulp");
var plumber = require("gulp-plumber");
var uglify = require("gulp-uglify");
var sass = require("gulp-sass")(require("sass"));
var wait = require("gulp-wait");
var rename = require("gulp-rename");
var autoprefixer = require("gulp-autoprefixer");
// var imagemin = require('gulp-imagemin');
const { series } = require("gulp");
gulp.task("scripts", function () {
return gulp
.src("scripts/scripts.js")
.pipe(
plumber(
plumber({
errorHandler: function (err) {
console.log(err);
this.emit("end");
},
})
)
)
.pipe(uglify({ output: { comments: "/^!/" } }))
.pipe(rename({ extname: ".min.js" }))
.pipe(gulp.dest("scripts"));
});
gulp.task("styles", function () {
return gulp
.src("styles/styles.scss")
.pipe(wait(250))
.pipe(
sass({
outputStyle: "compressed",
}).on("error", sass.logError)
)
.pipe(rename({ extname: ".css" }))
.pipe(gulp.dest("styles"));
});
// Optimize Images
// gulp.task('images', () =>
// gulp.src('images/*')
// .pipe(imagemin())
// .pipe(gulp.dest('min'))
// );
gulp.task("watch", function () {
gulp.watch("scripts/scripts.js", gulp.series("scripts"));
gulp.watch("styles/styles.scss", gulp.series("styles"));
});
exports.default = series("styles", "scripts");