-
Notifications
You must be signed in to change notification settings - Fork 40
/
gulpfile.js
176 lines (155 loc) · 5.12 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
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
var gulp = require('gulp'),
watch = require('gulp-watch'),
jsdoc = require('gulp-jsdoc3'),
concat = require('gulp-concat'),
uglify = require('gulp-uglify'),
fileInsert = require('gulp-file-insert'),
rename = require('gulp-rename'),
header = require('gulp-header'),
clean = require('gulp-clean'),
packageJson = require('./package.json');
gulp.task("clean", function () {
"use strict";
gulp.src([
"dist",
"demos/libs",
"docs"
], {read: false})
.pipe(clean());
});
gulp.task("doc-client", function (cb) {
"use strict";
var config = require('./jsdoc-client.json');
gulp.src(["package.json", "README.md", "client/*.js"], {read: false})
.pipe(jsdoc(config, cb));
});
gulp.task("doc-server", function (cb) {
"use strict";
var config = require('./jsdoc-server.json');
gulp.src(["package.json", "README.md", "server/*.js"], {read: false})
.pipe(jsdoc(config, cb));
});
gulp.task("sketchpad-vanilla", function () {
"use strict";
return gulp.src([
"client/_eventsmanager.js",
"client/colorpalette.js",
"client/events.js",
"client/fontpalette.js",
"client/formpalette.js",
"client/imagehost.js",
"client/keyshortcuts.js",
"client/misc.js",
"client/NSSketchpad-agpl.js",
"client/pixelpicker.js",
"client/polyfill.js",
"client/progressbar.js",
"client/resources.js",
"client/sketchpad.input.js",
"client/sketchpad.js",
"client/sketchpad.room.js",
"client/sketchpad.sketch.js",
"client/sketchpad.tool.js",
"client/sketchpad.tool.*.js",
"client/thickness.js"
])
.pipe(concat("sketchpad.js"))
.pipe(gulp.dest("dist/"))
.pipe(gulp.dest("demos/libs/"))
.pipe(uglify())
.pipe(header("/*sketchpad.pro - free online drawing*/"))
.pipe(rename({
suffix: ".min"
}))
.pipe(gulp.dest("dist/"))
.pipe(gulp.dest("demos/libs/"));
});
gulp.task("sketchpad-jquery", ["sketchpad-vanilla"], function () {
"use strict";
return gulp.src(["client/jquery.sketchpad-template.js"])
.pipe(fileInsert({
"/* file: sketchpad.js */": "dist/sketchpad.js"
}))
.pipe(rename({
basename: "jquery.sketchpad"
}))
.pipe(uglify())
.pipe(header("/*sketchpad.pro - free online drawing*/"))
.pipe(rename({
suffix: ".min"
}))
.pipe(gulp.dest("dist/"))
.pipe(gulp.dest("demos/libs/"));
});
// Manage CSS dependencies
gulp.task("dependencies-css-bootstrap", function () {
"use strict";
return gulp.src([
"node_modules/bootstrap/dist/css/bootstrap.min.css",
"node_modules/bootstrap/dist/css/bootstrap.min.css.map"
])
.pipe(gulp.dest("demos/libs/"));
});
gulp.task("dependencies-css-fontawesome", function () {
"use strict";
return gulp.src("node_modules/@fortawesome/fontawesome-free/css/all.min.css")
.pipe(rename('fontawesome.min.css'))
.pipe(gulp.dest("demos/libs/"));
});
gulp.task("dependencies-css", function () {
"use strict";
return gulp.start("dependencies-css-bootstrap", "dependencies-css-fontawesome");
});
// Manage Font Dependencies
gulp.task("dependencies-font-fontawesome", function () {
"use strict";
return gulp.src("node_modules/@fortawesome/fontawesome-free/webfonts/*")
.pipe(gulp.dest("demos/webfonts/"));
});
gulp.task("dependencies-font", function () {
"use strict";
return gulp.start("dependencies-font-fontawesome");
});
// Manage JS Dependencies
gulp.task("dependencies-js-fontawesome", function () {
"use strict";
return gulp.src([
"node_modules/@fortawesome/fontawesome-free/js/all.min.js"
])
.pipe(rename('fontawesome.min.js'))
.pipe(gulp.dest("demos/libs/"));
});
gulp.task("dependencies-js-bootstrap", function () {
"use strict";
return gulp.src([
"node_modules/bootstrap/dist/js/bootstrap.min.js",
"node_modules/bootstrap/dist/js/bootstrap.min.js.map",
"node_modules/popper.js/dist/popper.min.js",
"node_modules/popper.js/dist/popper.min.js.map"
])
.pipe(gulp.dest("demos/libs/"));
});
gulp.task("dependencies-js-jquery", function () {
"use strict";
return gulp.src([
"node_modules/jquery/dist/jquery.min.js",
"node_modules/jquery/dist/jquery.min.map"
])
.pipe(gulp.dest("demos/libs/"));
});
gulp.task("dependencies-js", function () {
"use strict";
return gulp.start("dependencies-js-bootstrap", "dependencies-js-jquery", "dependencies-js-fontawesome");
});
// define tasks here
gulp.task("default", function () {
"use strict";
console.log("Building", packageJson.name, packageJson.version);
gulp.start("doc-client", "doc-server", "sketchpad-vanilla", "sketchpad-jquery", "dependencies-css", "dependencies-font", "dependencies-js");
});
gulp.task("watch", function () {
"use strict";
watch(["README.md", "*.js", "*.json", "client/*.js", "server/*.js"], function () {
gulp.start("default");
});
});