-
Notifications
You must be signed in to change notification settings - Fork 19
/
Copy pathgulpfile.js
93 lines (83 loc) · 2.41 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
/**
* gulpfile.js for windowbuilder.js
*
* © Evgeniy Malyarov http://www.oknosoft.ru 2014-2016
*/
const gulp = require('gulp'),
base64 = require('gulp-base64'),
concat = require('gulp-concat'),
rename = require('gulp-rename'),
resources = require('./scripts/resource-concat.js'),
umd = require('gulp-umd'),
wrap = require("gulp-wrap");
module.exports = gulp;
// Cборка проекта
gulp.task('build-iface', function(){
return gulp.src([
'./data/merged_wb_templates.js',
'./src/modifiers/**/*.js',
'./src/widgets/*.js',
])
.pipe(concat('wnd_debug.js'))
.pipe(umd({
exports: function(file) {
return undefined;
}
}))
.pipe(gulp.dest('./public/dist'));
});
// Cборка библиотеки рисовалки
gulp.task('build-lib', function(){
return gulp.src([
'./src/editor/*.js',
'./src/tools/*.js',
'./data/merged_wb_tips.js'
])
.pipe(concat('windowbuilder.js'))
.pipe(umd({
exports: function(file) {
return 'Editor';
}
}))
.pipe(gulp.dest('./public/dist'));
});
// Сборка ресурсов рисовалки
gulp.task('injected-tips', function(){
return gulp.src([
'./src/templates/tip_*.html'
])
.pipe(resources('merged_wb_tips.js', function (data) {
return Buffer.from('$p.injected_data._mixin(' + JSON.stringify(data) + ');');
}))
.pipe(gulp.dest('./data'));
});
// Сборка ресурсов интерфейса
gulp.task('injected-templates', function(){
return gulp.src([
'./src/templates/xml/toolbar_calc_order_production.xml',
'./src/templates/xml/toolbar_calc_order_obj.xml',
'./src/templates/xml/toolbar_calc_order_selection.xml',
'./src/templates/xml/toolbar_product_list.xml',
'./src/templates/xml/toolbar_characteristics_specification.xml',
'./src/templates/xml/toolbar_glass_inserts.xml',
'./src/templates/xml/toolbar_discounts.xml',
'./src/templates/xml/toolbar_obj.xml',
'./src/templates/xml/tree_*.xml',
'./src/templates/view_*.html',
])
.pipe(resources('merged_wb_templates.js', function (data) {
return Buffer.from('$p.injected_data._mixin(' + JSON.stringify(data) + ');');
}))
.pipe(gulp.dest('./data'));
});
// Сборка css
gulp.task('css-base64', function () {
return gulp.src([
'./src/templates/iface.css',
'./src/templates/cursors/cursors.css',
'./src/templates/buttons20.css',
])
.pipe(base64())
.pipe(concat('windowbuilder.css'))
.pipe(gulp.dest('./src/styles'));
});