-
Notifications
You must be signed in to change notification settings - Fork 1
/
Gulpfile.js
74 lines (65 loc) · 1.86 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
import gulp from "gulp";
import autoprefixer from "gulp-autoprefixer";
import babel from "gulp-babel";
import cached from "gulp-cached";
import concat from "gulp-concat";
import less from "gulp-less";
import nodemon from "gulp-nodemon";
import gulpSrcMaps from "gulp-sourcemaps";
const { init, write } = gulpSrcMaps;
export const css = function () {
return gulp
.src("less/**/*.less")
.pipe(init())
.pipe(less())
.pipe(autoprefixer())
.pipe(concat("style.css"))
.pipe(write("."))
.pipe(gulp.dest("dist/public/stylesheets/"));
};
export const js = function () {
return gulp
.src(["src/**/*"])
.pipe(cached("babel"))
.pipe(init())
.pipe(babel())
.pipe(write(".", { includeContent: false, sourceRoot: "/src" }))
.pipe(gulp.dest("dist"));
};
export const copyToPublic = function () {
return gulp.src("public/**/*").pipe(gulp.dest("dist/public"));
};
export const bower = function () {
return gulp
.src(
[
"node_modules/requirejs/bin/r.js",
"node_modules/purecss/build/pure-min.css",
"node_modules/font-awesome/css/font-awesome.min.css",
"node_modules/font-awesome/fonts/*",
"node_modules/knockout/build/output/knockout-latest.js",
"node_modules/decojs/Dist/*",
],
{ base: "node_modules" }
)
.pipe(gulp.dest("dist/public/bower_components"));
};
export const build = gulp.series(css, js, copyToPublic, bower);
export const devServer = gulp.series(build, function () {
nodemon({
script: "dist/server.js",
ext: "js jsx",
env: { NODE_ENV: "development" },
watch: ["dist/"],
execMap: {
js: "node --inspect",
},
delay: 6,
});
});
export const watch = gulp.series(build, devServer, function () {
gulp.watch("less/**/*.less", css);
gulp.watch("public/**/*", copyToPublic);
gulp.watch("src/**/*", js);
});
export default build;