-
Notifications
You must be signed in to change notification settings - Fork 40
/
Copy pathgulpfile.js
98 lines (85 loc) · 2.22 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
var
gulp = require('gulp'),
fs = require('fs'),
path = require('path'),
uglify = require('gulp-uglify'),
concat = require('gulp-concat'),
slash = require('gulp-slash'),
del = require('del'),
less = require('gulp-less'),
paths =
{
less: './less/build.less',
js:
{
plugins: './browser/plugins/*.plugin.js',
player:
[
'./browser/vendor/gl-matrix.js',
'./browser/scripts/util.js',
'./browser/scripts/texture.js',
'./browser/scripts/renderer.js',
'./browser/scripts/shader.js',
'./browser/scripts/plugin-manager-bundled.js',
'./browser/scripts/plugin-group.js',
'./browser/scripts/connection.js',
'./browser/scripts/graph.js',
'./browser/scripts/node.js',
'./browser/scripts/registers.js',
'./browser/scripts/core.js',
'./browser/plugins/*.plugin.js',
'./browser/scripts/player.js',
'./browser/scripts/player-run.js'
]
}
};
gulp.task('clean:js:plugins', function(cb)
{
del('./browser/plugins/all.plugins.js', cb);
});
gulp.task('clean:js:player', function(cb)
{
del('./browser/scripts/player.min.js', cb);
});
gulp.task('clean:less', function(cb)
{
del('./browser/style/less.css', cb);
});
gulp.task('clean:js', ['clean:js:plugins', 'clean:js:player']);
gulp.task('clean', ['clean:js']);
gulp.task('js:plugins', ['clean:js:plugins'], function()
{
gulp.src(paths.js.plugins)
.pipe(slash())
.pipe(uglify())
.pipe(concat('all.plugins.js'))
.pipe(gulp.dest(path.join(__dirname, 'browser', 'plugins')))
});
gulp.task('js:player', ['clean:js:player'], function()
{
gulp.src(paths.js.player)
.pipe(slash())
.pipe(uglify())
.pipe(concat('player.min.js'))
.pipe(gulp.dest(path.join(__dirname, 'browser', 'scripts')))
});
gulp.task('js', ['js:plugins', 'js:player']);
gulp.task('less', ['clean:less'], function()
{
gulp.src(paths.less)
.pipe(slash())
.pipe(less({
paths: [ path.join(__dirname, 'less') ]
}))
.pipe(concat('less.css'))
.pipe(gulp.dest(path.join(__dirname, 'browser', 'style')));
});
gulp.task('watch', ['default'], function() {
gulp.watch('less/**/*', ['less']);
gulp.watch(paths.js.plugins, ['js:plugins']);
gulp.watch(paths.js.player, ['js:player']);
});
gulp.task('watch:less', function() {
gulp.watch('less/**/*', ['less']);
});
gulp.task('default', ['less', 'js']);