plate-map 2.0.6 → 3.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +84 -0
- package/README.md +49 -37
- package/dist/css/plate-map.css +0 -6
- package/dist/css/plate-map.min.css +1 -2
- package/dist/css/plate-map.min.css.map +1 -1
- package/dist/js/plate-map.js +866 -1512
- package/dist/js/plate-map.min.js +1 -2
- package/dist/js/plate-map.min.js.map +1 -1
- package/package.json +20 -15
- package/example/example.js +0 -216
- package/example/index.html +0 -26
- package/gulpfile.js +0 -190
- package/src/css/plate-layout.css +0 -592
- package/src/js/add-data-on-change.js +0 -178
- package/src/js/add-data-to-tabs.js +0 -19
- package/src/js/add-tab-data.js +0 -236
- package/src/js/add-warning-msg.js +0 -104
- package/src/js/bottom-table.js +0 -271
- package/src/js/check-box.js +0 -159
- package/src/js/color-manager.js +0 -59
- package/src/js/create-field.js +0 -1360
- package/src/js/engine.js +0 -185
- package/src/js/image_assets.js +0 -11
- package/src/js/interface.js +0 -100
- package/src/js/load-plate.js +0 -69
- package/src/js/overlay.js +0 -110
- package/src/js/plate-map.js +0 -409
- package/src/js/preset.js +0 -56
- package/src/js/svg-create.js +0 -126
- package/src/js/svg-events.js +0 -354
- package/src/js/tabs.js +0 -82
- package/src/js/undo-redo-manager.js +0 -76
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "plate-map",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "3.0.0",
|
|
4
4
|
"description": "JavaScript Plate Layout is an open source tool developed collaboratively by [Chai Biotechnologies](www.chaibio.com) and [New England Biolabs](www.neb.com) for visualizing and editing the layout of scientific assay plates.",
|
|
5
5
|
"scripts": {
|
|
6
6
|
"build.dist": "gulp build.dist",
|
|
@@ -8,7 +8,9 @@
|
|
|
8
8
|
"serve.dev": "gulp serve.dev",
|
|
9
9
|
"build.prod": "gulp build.prod",
|
|
10
10
|
"serve.prod": "gulp serve.prod",
|
|
11
|
-
"start": "gulp serve.dev"
|
|
11
|
+
"start": "gulp serve.dev",
|
|
12
|
+
"version": "npm run build.dist && git add dist",
|
|
13
|
+
"prepublishOnly": "npm run build.dist && git diff --exit-code --stat -- dist"
|
|
12
14
|
},
|
|
13
15
|
"repository": {
|
|
14
16
|
"type": "git",
|
|
@@ -24,7 +26,6 @@
|
|
|
24
26
|
},
|
|
25
27
|
"homepage": "https://github.com/nebiolabs/plate-map#readme",
|
|
26
28
|
"dependencies": {
|
|
27
|
-
"canvas": "^2.6.1",
|
|
28
29
|
"clipboard": "^2.0.6",
|
|
29
30
|
"jquery": "^3.5.1",
|
|
30
31
|
"jquery-ui-dist": "^1.12.1",
|
|
@@ -32,24 +33,28 @@
|
|
|
32
33
|
"svgjs": "^2.6.2"
|
|
33
34
|
},
|
|
34
35
|
"devDependencies": {
|
|
35
|
-
"@babel/core": "^
|
|
36
|
-
"@babel/preset-env": "^
|
|
37
|
-
"
|
|
38
|
-
"browser-sync": "^2.26.13",
|
|
36
|
+
"@babel/core": "^8.0.1",
|
|
37
|
+
"@babel/preset-env": "^8.0.2",
|
|
38
|
+
"browser-sync": "^3.0.4",
|
|
39
39
|
"del": "^5.0.0",
|
|
40
|
-
"gulp": "^
|
|
40
|
+
"gulp": "^5.0.1",
|
|
41
41
|
"gulp-babel": "^8.0.0",
|
|
42
42
|
"gulp-clean-css": "^4.3.0",
|
|
43
43
|
"gulp-concat": "^2.6.1",
|
|
44
44
|
"gulp-connect": "^5.7.0",
|
|
45
45
|
"gulp-inject": "^5.0.5",
|
|
46
46
|
"gulp-rename": "^2.0.0",
|
|
47
|
-
"gulp-
|
|
48
|
-
"gulp-uglify-es": "^2.0.0",
|
|
49
|
-
"merge-stream": "^2.0.0",
|
|
50
|
-
"run-sequence": "^2.2.1"
|
|
47
|
+
"gulp-uglify-es": "^2.0.0"
|
|
51
48
|
},
|
|
52
|
-
"
|
|
53
|
-
"
|
|
54
|
-
|
|
49
|
+
"devEngines": {
|
|
50
|
+
"runtime": {
|
|
51
|
+
"name": "node",
|
|
52
|
+
"version": ">=24.11",
|
|
53
|
+
"onFail": "error"
|
|
54
|
+
}
|
|
55
|
+
},
|
|
56
|
+
"files": [
|
|
57
|
+
"dist/",
|
|
58
|
+
"CHANGELOG.md"
|
|
59
|
+
]
|
|
55
60
|
}
|
package/example/example.js
DELETED
|
@@ -1,216 +0,0 @@
|
|
|
1
|
-
// Wait for all the script load from the loader.js and fire up
|
|
2
|
-
window.onload = function() {
|
|
3
|
-
let fields = [
|
|
4
|
-
{
|
|
5
|
-
required: true,
|
|
6
|
-
id: 'pol',
|
|
7
|
-
name: 'Polymerase',
|
|
8
|
-
type: 'multiselect',
|
|
9
|
-
placeHolder: "Polymerase",
|
|
10
|
-
options: [
|
|
11
|
-
{
|
|
12
|
-
id: 234,
|
|
13
|
-
text: 'Taq 1, processive enzyme with long name'
|
|
14
|
-
},
|
|
15
|
-
{
|
|
16
|
-
id: 123,
|
|
17
|
-
text: 'Taq 2'
|
|
18
|
-
},
|
|
19
|
-
{
|
|
20
|
-
id: 3,
|
|
21
|
-
text: 'Taq 3'
|
|
22
|
-
},
|
|
23
|
-
{
|
|
24
|
-
id: 4,
|
|
25
|
-
text: 'Taq 4'
|
|
26
|
-
},
|
|
27
|
-
{
|
|
28
|
-
id: 5,
|
|
29
|
-
text: 'Taq 5'
|
|
30
|
-
}
|
|
31
|
-
]
|
|
32
|
-
},
|
|
33
|
-
{
|
|
34
|
-
required: true,
|
|
35
|
-
id: 'volume',
|
|
36
|
-
name: 'Volume',
|
|
37
|
-
type: 'numeric',
|
|
38
|
-
placeholder: "Volume",
|
|
39
|
-
units: ["uL", "mL"],
|
|
40
|
-
defaultUnit: "uL"
|
|
41
|
-
},
|
|
42
|
-
{
|
|
43
|
-
required: true,
|
|
44
|
-
id: 'conc',
|
|
45
|
-
name: 'Concentration',
|
|
46
|
-
type: 'numeric',
|
|
47
|
-
placeholder: "Conc.",
|
|
48
|
-
defaultUnit: "ng/ul (final)"
|
|
49
|
-
},
|
|
50
|
-
{
|
|
51
|
-
required: true,
|
|
52
|
-
id: "on_ice",
|
|
53
|
-
name: "On Ice",
|
|
54
|
-
type: "boolean",
|
|
55
|
-
placeHolder: "On Ice"
|
|
56
|
-
}
|
|
57
|
-
];
|
|
58
|
-
let amplicons_fields = [
|
|
59
|
-
{
|
|
60
|
-
required: true,
|
|
61
|
-
id: 'amplicons',
|
|
62
|
-
name: "Amplicons",
|
|
63
|
-
type: "multiplex",
|
|
64
|
-
placeHolder: "Amplicons",
|
|
65
|
-
options: [
|
|
66
|
-
{
|
|
67
|
-
id: 11,
|
|
68
|
-
text: 'Amplicon_A'
|
|
69
|
-
},
|
|
70
|
-
{
|
|
71
|
-
id: 12,
|
|
72
|
-
text: 'Amplicon_B'
|
|
73
|
-
},
|
|
74
|
-
{
|
|
75
|
-
id: 13,
|
|
76
|
-
text: 'Amplicon_C'
|
|
77
|
-
},
|
|
78
|
-
{
|
|
79
|
-
id: 14,
|
|
80
|
-
text: 'Amplicon_D'
|
|
81
|
-
}
|
|
82
|
-
],
|
|
83
|
-
multiplexFields: [
|
|
84
|
-
{
|
|
85
|
-
required: true,
|
|
86
|
-
id: 'template_ngul',
|
|
87
|
-
setAll: true,
|
|
88
|
-
name: 'template conc',
|
|
89
|
-
type: 'select',
|
|
90
|
-
options: [
|
|
91
|
-
{id: 'a', text: "a"},
|
|
92
|
-
{id: 'b', text: "b"},
|
|
93
|
-
{id: 'c', text: "c"}
|
|
94
|
-
],
|
|
95
|
-
units: ['uM (final)', "unit1"],
|
|
96
|
-
defaultUnit: 'uM (final)'
|
|
97
|
-
},
|
|
98
|
-
{
|
|
99
|
-
required: true,
|
|
100
|
-
id: 'primer_umolarity',
|
|
101
|
-
name: 'Primer conc',
|
|
102
|
-
type: 'numeric',
|
|
103
|
-
placeHolder: "Primer",
|
|
104
|
-
units: ['uM (final)', "unit1"],
|
|
105
|
-
defaultUnit: 'uM (final)'
|
|
106
|
-
},
|
|
107
|
-
{
|
|
108
|
-
required: true,
|
|
109
|
-
id: 'probe_umolarity',
|
|
110
|
-
name: 'Probe conc',
|
|
111
|
-
type: 'numeric',
|
|
112
|
-
placeHolder: "Probe",
|
|
113
|
-
defaultUnit: 'uM (final)'
|
|
114
|
-
},
|
|
115
|
-
{
|
|
116
|
-
required: true,
|
|
117
|
-
id: 'dilution_factor',
|
|
118
|
-
name: 'Dilution factor',
|
|
119
|
-
type: 'numeric',
|
|
120
|
-
placeHolder: "Dilution factor",
|
|
121
|
-
// defaultUnit: 'X'
|
|
122
|
-
}
|
|
123
|
-
],
|
|
124
|
-
},
|
|
125
|
-
];
|
|
126
|
-
let attributes = {
|
|
127
|
-
presets: [
|
|
128
|
-
{
|
|
129
|
-
title: "Pol/Vol",
|
|
130
|
-
fields: ["volume", "pol"]
|
|
131
|
-
},
|
|
132
|
-
{
|
|
133
|
-
title: "Vol",
|
|
134
|
-
fields: ["volume"]
|
|
135
|
-
}
|
|
136
|
-
],
|
|
137
|
-
tabs: [
|
|
138
|
-
{
|
|
139
|
-
name: "Settings",
|
|
140
|
-
fields: fields
|
|
141
|
-
},
|
|
142
|
-
{
|
|
143
|
-
name: "Amplicons",
|
|
144
|
-
fields: amplicons_fields
|
|
145
|
-
}
|
|
146
|
-
]
|
|
147
|
-
};
|
|
148
|
-
window.plateData = {};
|
|
149
|
-
|
|
150
|
-
let widget = $("#my-plate-map");
|
|
151
|
-
|
|
152
|
-
function makeNewPlate() {
|
|
153
|
-
let d = widget.plateMap("getDimensions");
|
|
154
|
-
let rows = d.rows;
|
|
155
|
-
let cols = d.cols;
|
|
156
|
-
let wells = {};
|
|
157
|
-
for (let r = 0; r < rows; r++) {
|
|
158
|
-
let volume = 100;
|
|
159
|
-
let pol = (r < (rows / 2)) ? 234 : 123;
|
|
160
|
-
let on_ice = Boolean(r % 2);
|
|
161
|
-
for (let c = 0; c < cols; c++) {
|
|
162
|
-
let address = widget.plateMap("locToAddress", {"r": r, "c": c});
|
|
163
|
-
let v = volume;
|
|
164
|
-
let vunit = "mL";
|
|
165
|
-
let amplicons = [{
|
|
166
|
-
amplicons: 11,
|
|
167
|
-
template_ngul: 'a',
|
|
168
|
-
primer_umolarity: 2,
|
|
169
|
-
probe_umolarity: 3,
|
|
170
|
-
dilution_factor: 4
|
|
171
|
-
}, {
|
|
172
|
-
amplicons: 12,
|
|
173
|
-
template_ngul: 'b',
|
|
174
|
-
primer_umolarity: 22,
|
|
175
|
-
probe_umolarity: 33,
|
|
176
|
-
dilution_factor: 44
|
|
177
|
-
}];
|
|
178
|
-
if (v < 1) {
|
|
179
|
-
v *= 1000;
|
|
180
|
-
vunit = "uL";
|
|
181
|
-
}
|
|
182
|
-
wells[address] = {
|
|
183
|
-
volume: v,
|
|
184
|
-
pol: [pol],
|
|
185
|
-
amplicons: amplicons,
|
|
186
|
-
on_ice: on_ice
|
|
187
|
-
};
|
|
188
|
-
if ((c % 2) > 0) {
|
|
189
|
-
volume /= 10
|
|
190
|
-
}
|
|
191
|
-
}
|
|
192
|
-
}
|
|
193
|
-
return {
|
|
194
|
-
wells: wells,
|
|
195
|
-
checkboxes: ["volume", "pol"]
|
|
196
|
-
};
|
|
197
|
-
}
|
|
198
|
-
|
|
199
|
-
widget.plateMap({
|
|
200
|
-
numRows: 8,
|
|
201
|
-
numCols: 12,
|
|
202
|
-
attributes: attributes,
|
|
203
|
-
|
|
204
|
-
updateWells: function() {
|
|
205
|
-
//data has changed
|
|
206
|
-
window.plateData = widget.plateMap("getPlate") ;
|
|
207
|
-
console.log(Object.keys(window.plateData.wells).length + " wells updated");
|
|
208
|
-
},
|
|
209
|
-
created: function() {
|
|
210
|
-
console.log("Created");
|
|
211
|
-
}
|
|
212
|
-
});
|
|
213
|
-
window.plateData = makeNewPlate();
|
|
214
|
-
widget.plateMap("loadPlate", window.plateData);
|
|
215
|
-
widget.plateMap("clearHistory");
|
|
216
|
-
};
|
package/example/index.html
DELETED
|
@@ -1,26 +0,0 @@
|
|
|
1
|
-
<html>
|
|
2
|
-
<head>
|
|
3
|
-
<meta charset="utf-8">
|
|
4
|
-
<meta http-equiv="X-UA-Compatible" content="IE=edge">
|
|
5
|
-
<title>Plate Map</title>
|
|
6
|
-
<meta name="description" content="Plate Layout">
|
|
7
|
-
<meta name="viewport" content="width=device-width, initial-scale=1">
|
|
8
|
-
<link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.3.1/css/bootstrap.min.css" integrity="sha384-ggOyR0iXCbMQv3Xipma34MD+dH/1fQ784/j6cY/iJTQUOhcWr7x9JvoRxT2MZw1T" crossorigin="anonymous">
|
|
9
|
-
<!-- dependencies:css -->
|
|
10
|
-
<!-- endinject -->
|
|
11
|
-
<!-- inject:css -->
|
|
12
|
-
<!-- endinject -->
|
|
13
|
-
<!-- dependencies:js -->
|
|
14
|
-
<!-- endinject -->
|
|
15
|
-
<!-- inject:js -->
|
|
16
|
-
<!-- endinject -->
|
|
17
|
-
</head>
|
|
18
|
-
<body>
|
|
19
|
-
<div id="my-plate-map" class="plate-setup-container">
|
|
20
|
-
Loading plate layout ... !
|
|
21
|
-
</div>
|
|
22
|
-
<br/>
|
|
23
|
-
<!-- example:js -->
|
|
24
|
-
<!-- endinject -->
|
|
25
|
-
</body>
|
|
26
|
-
</html>
|
package/gulpfile.js
DELETED
|
@@ -1,190 +0,0 @@
|
|
|
1
|
-
const gulp = require('gulp');
|
|
2
|
-
const del = require("del");
|
|
3
|
-
const concat = require('gulp-concat');
|
|
4
|
-
const rename = require('gulp-rename');
|
|
5
|
-
const uglify = require('gulp-uglify-es').default;
|
|
6
|
-
const minifyCSS = require('gulp-clean-css');
|
|
7
|
-
const inject = require('gulp-inject');
|
|
8
|
-
const browserSync = require('browser-sync').create();
|
|
9
|
-
const connect = require('gulp-connect');
|
|
10
|
-
const mergeStream = require('merge-stream');
|
|
11
|
-
|
|
12
|
-
const sourcemaps = require('gulp-sourcemaps');
|
|
13
|
-
const babel = require('gulp-babel');
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
const packageName = 'plate-map';
|
|
17
|
-
const PATH = {
|
|
18
|
-
source: {
|
|
19
|
-
css: ['src/css/*.css'],
|
|
20
|
-
js: ['src/js/*.js'],
|
|
21
|
-
},
|
|
22
|
-
example: {
|
|
23
|
-
js: 'example/example.js',
|
|
24
|
-
html: 'example/index.html'
|
|
25
|
-
},
|
|
26
|
-
dependencies: {
|
|
27
|
-
css: [
|
|
28
|
-
'node_modules/select2/dist/css/select2.css'
|
|
29
|
-
],
|
|
30
|
-
js: [
|
|
31
|
-
'node_modules/jquery/dist/jquery.js',
|
|
32
|
-
'node_modules/jquery-ui-dist/jquery-ui.js',
|
|
33
|
-
'node_modules/select2/dist/js/select2.js',
|
|
34
|
-
'node_modules/svgjs/dist/svg.js',
|
|
35
|
-
'node_modules/clipboard/dist/clipboard.js'
|
|
36
|
-
]
|
|
37
|
-
},
|
|
38
|
-
destination: {
|
|
39
|
-
prod: {
|
|
40
|
-
css: 'build/prod/css',
|
|
41
|
-
js: 'build/prod/js',
|
|
42
|
-
root: 'build/prod'
|
|
43
|
-
},
|
|
44
|
-
dev: {
|
|
45
|
-
css: 'build/dev/css',
|
|
46
|
-
js: 'build/dev/js',
|
|
47
|
-
root: 'build/dev'
|
|
48
|
-
},
|
|
49
|
-
pack: {
|
|
50
|
-
css: 'dist/css',
|
|
51
|
-
js: 'dist/js',
|
|
52
|
-
root: 'dist'
|
|
53
|
-
}
|
|
54
|
-
}
|
|
55
|
-
};
|
|
56
|
-
|
|
57
|
-
let config = {destination: {css: '', js: '', root: ''}};
|
|
58
|
-
|
|
59
|
-
function concat_minify_css(name, source, destination) {
|
|
60
|
-
return gulp.src(source)
|
|
61
|
-
.pipe(sourcemaps.init())
|
|
62
|
-
.pipe(concat(name + '.css'))
|
|
63
|
-
.pipe(gulp.dest(destination))
|
|
64
|
-
.pipe(minifyCSS())
|
|
65
|
-
.pipe(rename(name + '.min.css'))
|
|
66
|
-
.pipe(sourcemaps.write('.'))
|
|
67
|
-
.pipe(gulp.dest(destination));
|
|
68
|
-
}
|
|
69
|
-
|
|
70
|
-
function concat_uglify_js(name, source, destination) {
|
|
71
|
-
return gulp.src(source)
|
|
72
|
-
.pipe(sourcemaps.init())
|
|
73
|
-
.pipe(concat(name + '.js'))
|
|
74
|
-
.pipe(babel({
|
|
75
|
-
presets: ['@babel/env']
|
|
76
|
-
}))
|
|
77
|
-
.pipe(gulp.dest(destination))
|
|
78
|
-
.pipe(uglify())
|
|
79
|
-
.pipe(rename(name + '.min.js'))
|
|
80
|
-
.pipe(sourcemaps.write('.'))
|
|
81
|
-
.pipe(gulp.dest(destination));
|
|
82
|
-
}
|
|
83
|
-
|
|
84
|
-
function config_env(env) {
|
|
85
|
-
config.destination.css = PATH.destination[env].css;
|
|
86
|
-
config.destination.js = PATH.destination[env].js;
|
|
87
|
-
config.destination.root = PATH.destination[env].root;
|
|
88
|
-
}
|
|
89
|
-
|
|
90
|
-
gulp.task('config.prod', async () => {
|
|
91
|
-
config_env('prod');
|
|
92
|
-
});
|
|
93
|
-
|
|
94
|
-
gulp.task('config.dev', async () => {
|
|
95
|
-
config_env('dev');
|
|
96
|
-
});
|
|
97
|
-
|
|
98
|
-
gulp.task('config.pack', async () => {
|
|
99
|
-
config_env('pack');
|
|
100
|
-
});
|
|
101
|
-
|
|
102
|
-
gulp.task('clean', () => {
|
|
103
|
-
return del([config.destination.root]);
|
|
104
|
-
});
|
|
105
|
-
|
|
106
|
-
gulp.task('css', () => {
|
|
107
|
-
return concat_minify_css(packageName, PATH.source.css, config.destination.css);
|
|
108
|
-
});
|
|
109
|
-
|
|
110
|
-
gulp.task('js', () => {
|
|
111
|
-
return concat_uglify_js(packageName, PATH.source.js, config.destination.js);
|
|
112
|
-
});
|
|
113
|
-
|
|
114
|
-
gulp.task('copy.other', () => {
|
|
115
|
-
const css = gulp.src(PATH.dependencies.css)
|
|
116
|
-
.pipe(gulp.dest(config.destination.css));
|
|
117
|
-
const js = gulp.src(PATH.dependencies.js)
|
|
118
|
-
.pipe(gulp.dest(config.destination.js));
|
|
119
|
-
const ex_js = gulp.src(PATH.example.js)
|
|
120
|
-
.pipe(gulp.dest(config.destination.js));
|
|
121
|
-
return mergeStream(css, js, ex_js);
|
|
122
|
-
});
|
|
123
|
-
|
|
124
|
-
gulp.task('copy.src', () => {
|
|
125
|
-
const css = gulp.src(PATH.source.css)
|
|
126
|
-
.pipe(gulp.dest(config.destination.css));
|
|
127
|
-
const js = gulp.src(PATH.source.js)
|
|
128
|
-
.pipe(gulp.dest(config.destination.js));
|
|
129
|
-
return mergeStream(css, js);
|
|
130
|
-
});
|
|
131
|
-
|
|
132
|
-
function jsLink (filePath) {
|
|
133
|
-
const fileName = filePath.substring(filePath.lastIndexOf("/") + 1, filePath.length);
|
|
134
|
-
return '<script src="js/' + fileName + '"></script>';
|
|
135
|
-
}
|
|
136
|
-
|
|
137
|
-
function cssLink (filePath) {
|
|
138
|
-
const fileName = filePath.substring(filePath.lastIndexOf("/") + 1, filePath.length);
|
|
139
|
-
return '<link rel="stylesheet" href="css/' + fileName + '">';
|
|
140
|
-
}
|
|
141
|
-
|
|
142
|
-
gulp.task('inject.prod', () => {
|
|
143
|
-
return gulp.src(PATH.example.html)
|
|
144
|
-
.pipe(inject(gulp.src(PATH.dependencies.css, {read: false}), {transform: cssLink, name: 'dependencies'}))
|
|
145
|
-
.pipe(inject(gulp.src(PATH.dependencies.js, {read: false}), {transform: jsLink, name: 'dependencies'}))
|
|
146
|
-
.pipe(inject(gulp.src([`${config.destination.css}/${packageName}.min.css`, `${config.destination.js}/${packageName}.min.js`], {read: false}),
|
|
147
|
-
{
|
|
148
|
-
ignorePath: config.destination.root,
|
|
149
|
-
addRootSlash: false
|
|
150
|
-
}))
|
|
151
|
-
.pipe(inject(gulp.src(PATH.example.js, {read: false}), {transform: jsLink, name: 'example'}))
|
|
152
|
-
.pipe(gulp.dest(config.destination.root));
|
|
153
|
-
});
|
|
154
|
-
|
|
155
|
-
gulp.task('inject.dev', () => {
|
|
156
|
-
return gulp.src(PATH.example.html)
|
|
157
|
-
.pipe(inject(gulp.src(PATH.dependencies.css, {read: false}), {transform: cssLink, name: 'dependencies'}))
|
|
158
|
-
.pipe(inject(gulp.src(PATH.dependencies.js, {read: false}), {transform: jsLink, name: 'dependencies'}))
|
|
159
|
-
.pipe(inject(gulp.src(PATH.source.css, {read: false}), {transform: cssLink}))
|
|
160
|
-
.pipe(inject(gulp.src(PATH.source.js, {read: false}), {transform: jsLink}))
|
|
161
|
-
.pipe(inject(gulp.src(PATH.example.js, {read: false}), {transform: jsLink, name: 'example'}))
|
|
162
|
-
.pipe(gulp.dest(config.destination.root));
|
|
163
|
-
});
|
|
164
|
-
|
|
165
|
-
gulp.task('server.dev', async () => {
|
|
166
|
-
browserSync.init({server: PATH.destination.dev.root});
|
|
167
|
-
gulp.watch(PATH.source.app.css.concat(PATH.source.app.js), gulp.series('build.dev', browserSync.reload));
|
|
168
|
-
});
|
|
169
|
-
|
|
170
|
-
gulp.task('server.prod', async () => {
|
|
171
|
-
connect.server({
|
|
172
|
-
name: 'App [PRODUCTION MODE]',
|
|
173
|
-
root: PATH.destination.prod.root
|
|
174
|
-
});
|
|
175
|
-
});
|
|
176
|
-
|
|
177
|
-
gulp.task('build.dist', gulp.series('config.pack', 'clean', 'css', 'js'));
|
|
178
|
-
|
|
179
|
-
gulp.task('build.dev', gulp.series('config.dev', 'clean', 'copy.other', 'copy.src', 'inject.dev'));
|
|
180
|
-
|
|
181
|
-
gulp.task('serve.dev', gulp.series('build.dev', 'server.dev'));
|
|
182
|
-
|
|
183
|
-
gulp.task('build.prod', gulp.series('config.prod', 'clean', 'copy.other', 'css', 'js', 'inject.prod'));
|
|
184
|
-
|
|
185
|
-
gulp.task('serve.prod', gulp.series('build.prod', 'server.prod'));
|
|
186
|
-
|
|
187
|
-
gulp.task('default', gulp.series('serve.dev'));
|
|
188
|
-
|
|
189
|
-
gulp.task('build.all', gulp.series('build.dev', 'build.prod', 'build.dist'));
|
|
190
|
-
|