-
Notifications
You must be signed in to change notification settings - Fork 14
/
Copy pathgulpfile.js
102 lines (90 loc) · 1.92 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
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
var ts = require("gulp-typescript"),
pkg = require("./package.json"),
pug = require("gulp-pug"),
gulp = require("gulp"),
less = require("gulp-less"),
clean = require("gulp-clean-css"),
uglify = require("gulp-uglify"),
rename = require("gulp-rename"),
header = require("gulp-header"),
jshint = require("gulp-jshint"),
stylish = require("jshint-stylish");
var banner = [
"/**",
" * Vanilla JavaScript Tabs v<%= pkg.version %>",
" * <%= pkg.homepage %>",
" */",
"",
].join("\n");
gulp.task("ts", function () {
return gulp
.src("./src/javascript/vanilla-js-tabs.ts")
.pipe(
ts({
target: "es2015",
lib: ["es2015", "dom"],
noImplicitAny: true,
outFile: "vanilla-js-tabs.js",
})
)
.pipe(gulp.dest("./dist"));
});
gulp.task("script", function (done) {
gulp
.src(["./dist/vanilla-js-tabs.js"])
.pipe(uglify())
.pipe(
header(banner, {
pkg: pkg,
})
)
.pipe(
rename({
suffix: ".min",
})
)
.pipe(gulp.dest("./dist"))
.pipe(gulp.dest("./docs/javascript"));
done();
});
gulp.task("markup", function (done) {
gulp
.src("./src/index.pug")
.pipe(
pug({
pretty: true,
})
)
.pipe(gulp.dest("./dist"));
done();
});
gulp.task("styles", function (done) {
gulp
.src("./src/styles/*.less")
.pipe(less())
.pipe(gulp.dest("./dist"))
.pipe(gulp.dest("./docs/styles"));
done();
});
gulp.task("docs-styles", function (done) {
gulp
.src("./docs/styles/*.less")
.pipe(less())
.pipe(
clean({
compatibility: "ie9",
})
)
.pipe(gulp.dest("./docs/styles"));
done();
});
gulp.task("lint", function () {
return gulp
.src("./src/javascript/*.js")
.pipe(jshint(".jshintrc"))
.pipe(jshint.reporter(stylish));
});
gulp.task(
"default",
gulp.series("ts", "script", "markup", "styles", "docs-styles", "lint")
);