-
Notifications
You must be signed in to change notification settings - Fork 1
/
gulpfile.js
114 lines (101 loc) · 3.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
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
/**
* The '--production' parameter allows to minimize the JS and CSS code.
*
* Minimal requirements: NodeJS v6.9+, gulp module installed globally, i.e., use 'npm install -g gulp'.
*
* NOTE: for the first time, one need to execute: 'npm install' to get all the NodeJS
* dependency modules described in the package.json file and used by this gulp file.
*/
// dependency NodeJS modules
const argv = require( "yargs").argv,
gulp = require( "gulp"),
concat = require( "gulp-concat"),
notify = require("gulp-notify"),
gulpif = require("gulp-if"),
uglify = require("gulp-uglify"),
//cleanCSS = require("gulp-clean-css"),
tap = require("gulp-tap"),
del = require("del"),
jshint = require('gulp-jshint');
// the folder where the distribution library file is created.
const buildFolder = "dist";
// the JS files of the cLASSjs Browser Library
const cLASSjsBrowserLibFiles = [
"lib/browserShims.js",
"lib/errorTypes.js",
"lib/util.js",
"src/eNUMERATION.js",
"src/cLASS.js",
"lib/dom.js",
"src/oBJECTvIEW.js",
"lib/idb.js",
"src/storage/sTORAGEmANAGER.js",
"src/storage/sTORAGEmANAGER_IndexedDB.js"
];
// the JS files of the cLASSjs Worker Library
const cLASSjsWorkerLibFiles = [
"lib/browserShims.js",
"lib/errorTypes.js",
"lib/util.js",
"src/eNUMERATION.js",
"src/cLASS.js",
"lib/idb.js",
"src/storage/sTORAGEmANAGER.js",
"src/storage/sTORAGEmANAGER_IndexedDB.js"
];
// build the cLASSjsBrowserLib.js file
gulp.task( "build-browser-lib", function() {
return gulp.src( cLASSjsBrowserLibFiles)
.pipe( concat("cLASSjsBrowserLib.js"))
.pipe( gulpif( argv.production, uglify()))
.pipe( gulp.dest( buildFolder))
.pipe( notify({message: "cLASSjsBrowserLib.js was built!"}));
});
gulp.task( "build-css", function() {
return gulp.src(
[ "css/normalize.css",
"css/vIEW.css"
])
.pipe( concat( "cLASS.css"))
// .pipe( gulpif( argv.production, cleanCSS()))
.pipe( gulp.dest( buildFolder))
});
// build the cLASSjsWorkerLib.js file
gulp.task( "build-worker-lib", function() {
return gulp.src( cLASSjsWorkerLibFiles)
.pipe( concat("cLASSjsWorkerLib.js"))
.pipe( gulpif( argv.production, uglify()))
.pipe( gulp.dest( buildFolder))
.pipe( notify({message: "cLASSjsWorkerLib.js was built!"}));
});
gulp.task( "build", [
"build-browser-lib",
"build-css",
"build-worker-lib"
]);
// build the cLASSjsNodeLib.js file
gulp.task( "build-node", function() {
return gulp.src([
"lib/errorTypes.js",
"lib/util.js",
"src/eNUMERATION.js",
"src/cLASS.js"
])
.pipe( concat("cLASSjsNodeLib.js"))
.pipe( gulpif( argv.production, uglify()))
.pipe( gulp.dest( buildFolder))
.pipe( notify({message: "cLASSjsNodeLib.js was built!"}));
});
gulp.task('dev', function () {
gulp.src([
"lib/browserShims.js",
"lib/errorTypes.js",
"lib/util.js",
"src/eNUMERATION.js",
"src/cLASS.js",
"lib/dom.js",
"src/oBJECTvIEW.js"
])
.pipe(jshint('.jshintrc'))
.pipe(jshint.reporter('default'));
});