-
Notifications
You must be signed in to change notification settings - Fork 3
/
gulpfile.js
46 lines (39 loc) · 1.32 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
"use strict";
var SRC = "client"
var BUILD = "build"
var es2015 = require("babel-preset-es2015");
var gulp = require("gulp")
var path = require("path")
var sass = require("gulp-sass")(require("sass"))
var autoprefixer = require("gulp-autoprefixer")
var babel = require("gulp-babel")
var uglify = require("gulp-uglify")
var image = require("gulp-image")
// var $ = require("gulp-load-plugins")()
gulp.task("watch", function(){
gulp.watch(path.join(SRC, "scss/**/*"), gulp.series("sass"))
gulp.watch(path.join(SRC, "js/**/*"), gulp.series("js"))
gulp.watch(path.join(SRC, "images/**/*"), gulp.series("images"))
})
gulp.task("sass", function() {
return gulp.src(path.join(SRC, "scss/{style.scss,admin.scss,*.css}"))
.pipe(sass({outputStyle: "compressed"}))
.pipe(autoprefixer({
browsers: ["last 2 versions", "> 1%"],
cascade: false,
remove: false
}))
.pipe(gulp.dest(path.join(BUILD, "css")))
})
gulp.task("js", function() {
return gulp.src(path.join(SRC, "js/*.*"))
.pipe(babel({ presets: [es2015] }))
.pipe(uglify())
.pipe(gulp.dest(path.join(BUILD, "js")))
})
gulp.task("images", function() {
return gulp.src(path.join(SRC, "images/*.*"))
.pipe(image())
.pipe(gulp.dest(path.join(BUILD, "images")))
})
gulp.task("build", gulp.series("sass", "js", "images"))