-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathgulpfile.js
More file actions
47 lines (38 loc) · 889 Bytes
/
gulpfile.js
File metadata and controls
47 lines (38 loc) · 889 Bytes
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
// -- gulp -- //
import { src, dest, task, series, parallel, watch } from "gulp";
// -- plugins -- //
import gulpTs from 'gulp-typescript';
import gulpSass from 'gulp-sass';
import * as sassCompiler from 'sass';
const plug = {
ts: gulpTs.createProject("tsconfig.json"),
sass: gulpSass(sassCompiler),
};
const paths = {
ts: ["src/*.ts", "!src/*.d.ts"],
sass: ["src/*.scss"],
};
// -- builders -- //
function ts() {
return src(paths.ts)
.pipe(plug.ts())
.pipe(dest("lib"));
}
function sass() {
return src(paths.sass)
.pipe(plug.sass().on('error', plug.sass.logError))
.pipe(dest("lib"));
}
// -- tasks -- //
task("build", done => {
series(parallel(ts, sass))(done);
});
task("watcher", done => {
for (const [builder, path] of Object.entries(paths)) {
watch(path, { ts, sass }[builder]);
}
done();
});
task("dev", done => {
series("build", "watcher")(done);
});