-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathgulpfile.js
40 lines (36 loc) · 1.02 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
const gulp = require("gulp");
const sass = require("gulp-sass");
const rename = require("gulp-rename");
const srcmaps = require("gulp-sourcemaps");
const autoprefixer = require("gulp-autoprefixer");
const minifyjs = require("gulp-js-minify");
// const babel = require("gulp-babel");
gulp.task("sass", function() {
return gulp
.src("src-styles/main.sass")
.pipe(srcmaps.init())
.pipe(sass({ outputStyle: "compressed" }).on("error", sass.logError))
.pipe(
autoprefixer({
browsers: ["last 2 versions"],
cascade: false
})
)
.pipe(rename("style.css"))
.pipe(srcmaps.write("./"))
.pipe(gulp.dest("./public/styles/"));
});
gulp.task("js", function() {
return gulp
.src("src-scripts/**/*.js")
.pipe(srcmaps.init())
.pipe(minifyjs())
.pipe(srcmaps.write("./"))
.pipe(gulp.dest("./public/scripts/"));
});
gulp.task("watch", function() {
gulp.watch("src-styles/**/*.sass", ["sass"]);
gulp.watch("src-scripts/**/*.js", ["js"]);
console.log("Watching for changes...");
});
gulp.task("default", ["watch"]);