forked from lightnet328/lightnet328.com
-
Notifications
You must be signed in to change notification settings - Fork 0
/
gulpfile.js
49 lines (44 loc) · 1.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
var gulp = require("gulp");
var plumber = require("gulp-plumber");
var concat = require("gulp-concat");
var uglify = require("gulp-uglify");
var sass = require("gulp-sass");
var autoprefixer = require("gulp-autoprefixer");
var cssimport = require("gulp-cssimport");
var cssmin = require("gulp-cssmin");
gulp.task("script", function() {
gulp.src([
"node_modules/jquery/dist/jquery.min.js",
"src/scripts/**/*.js"
])
.pipe(plumber())
.pipe(concat("script.js"))
.pipe(uglify({
output: {
comments: /^!/
}
}))
.pipe(gulp.dest("./assets/scripts"))
});
gulp.task("style", function() {
gulp.src("src/styles/**/*.scss")
.pipe(plumber())
.pipe(sass())
.pipe(autoprefixer())
.pipe(cssimport({
includePaths: ["styles"],
skipComments: false,
}))
.pipe(cssmin())
.pipe(gulp.dest("./assets/styles"))
});
gulp.task("image", function() {
gulp.src("src/images/**/*.png")
.pipe(gulp.dest("./assets/images"))
});
gulp.task("build", ["script", "style", "image"]);
gulp.task("default", function() {
gulp.watch("src/scripts/**/*.js", ["script"]);
gulp.watch("src/styles/**/*.scss", ["style"]);
gulp.watch("src/images/**/*.png", ["image"]);
});