forked from makenai/robotnik
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathgulpfile.js
117 lines (101 loc) · 2.83 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
'use strict';
var browserify = require('browserify');
var es6ify = require('es6ify');
var partialify = require('partialify');
var gulp = require('gulp');
var source = require('vinyl-source-stream');
var uglify = require('gulp-uglify');
var watch = require('gulp-watch');
var concat_json = require("gulp-concat-json");
gulp.task('icons', function () {
return gulp.src([
'./static/vendor/font-awesome/fonts/**.*',
'./static/vendor/bootstrap/fonts/**.*'
])
.pipe(gulp.dest('static/fonts'))
.on('error', console.log);
});
gulp.task('blockly', function () {
return gulp.src([
'./node_modules/blockly/**',
])
.pipe(gulp.dest('./static/vendor/blockly'))
.on('error', console.log);
});
gulp.task('bootstrap', function() {
return gulp.src([
'./node_modules/bootstrap/dist/**'
])
.pipe(gulp.dest('./static/vendor/bootstrap/dist/'))
.on('error', console.log);
});
gulp.task('fonts', function() {
return gulp.src([
'./node_modules/font-awesome/**',
])
.pipe(gulp.dest('./static/vendor/font-awesome/'))
.on('error', console.log);
});
gulp.task('workshops', function () {
return gulp.src('./workshops/*.json')
.pipe(concat_json("bundled-workshops.json"))
.pipe(gulp.dest("./static/js/src"));
});
gulp.task('boards', function () {
return gulp.src('./boards/*.json')
.pipe(concat_json("bundled-boards.json"))
.pipe(gulp.dest("./static/js/src"));
});
gulp.task('vendor', function() {
return browserify({
entries: [
'./static/js/src/vendor.js'
],
debug: false,
cache: { },
packageCache: { },
fullPaths: true
})
.bundle()
//Pass desired output filename to vinyl-source-stream
.pipe(source('vendor.js'))
// Start piping stream to tasks!
.pipe(gulp.dest('./static/js/'));
});
gulp.task('bundle', function() {
return browserify({
entries: [
'./static/js/src/app.js'
],
debug: true,
cache: { },
packageCache: { },
fullPaths: true
})
.transform(partialify)
.transform(
// Don't ES6-ify vendor files
es6ify.configure(/\/robotnik\/static\/js\/src\/.*\.js$/)
)
.bundle()
//Pass desired output filename to vinyl-source-stream
.pipe(source('app.js'))
// Start piping stream to tasks!
.pipe(gulp.dest('./static/js/'));
});
gulp.task('watch', function() {
gulp.start('vendor');
gulp.start('workshops');
watch(['./workshops/*.json'], function() {
gulp.start('workshops');
});
gulp.start('boards');
watch(['./boards/*.json'], function() {
gulp.start('boards');
});
gulp.start('bundle');
watch(['./static/js/src/**/*.js', './static/js/src/**/*.html'], function() {
gulp.start('bundle');
});
});
gulp.task('default', ['icons', 'blockly', 'bootstrap', 'fonts', 'boards', 'workshops', 'vendor', 'bundle']);