-
Notifications
You must be signed in to change notification settings - Fork 22
/
Copy pathgulpfile.js
executable file
·73 lines (68 loc) · 2.31 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
var gulp = require('gulp')
, uglify = require('gulp-uglify')
, concat = require('gulp-concat-util')
, wrap = require('gulp-wrap')
, tap = require('gulp-tap')
, header = require('gulp-header')
, path = require('path')
, version
, glowscript_libraries;
version = '1.1';
glowscript_libraries = {
"glow": [
"lib/jquery/jquery.mousewheel.js",
"lib/flot/jquery.flot.min.js",
"lib/flot/jquery.flot.crosshair_GS.js",
"lib/flot/jquery.flot.axislabels.js",
"lib/glMatrix.js",
"lib/webgl-utils.js",
"lib/glow/property.js",
"lib/glow/vectors.js",
"lib/glow/mesh.js",
"lib/glow/canvas.js",
"lib/glow/orbital_camera.js",
"lib/glow/autoscale.js",
"lib/glow/WebGLRenderer.js",
"lib/glow/graph.js",
"lib/glow/color.js",
"lib/glow/primitives.js",
"lib/glow/api_misc.js",
"lib/glow/shaders.gen.js"
],
"compiler": [
"../lib/compiler.js",
"../lib/papercomp.js",
"../lib/transform-all.js",
"../lib/coffee-script.js"],
RSrun: [
"../lib/rapydscript/stdlib.js"],
RScompile: [
"../lib/compiler.js",
"../lib/papercomp.js",
"../lib/transform-all.js",
"../lib/rapydscript/baselib.js",
"../lib/rapydscript/utils.js",
"../lib/rapydscript/ast.js",
"../lib/rapydscript/output.js",
"../lib/rapydscript/parse.js"],
};
gulp.task('default', function() {
var shaders = []
, shader_key;
gulp.src('./shaders/*.shader')
.pipe(tap(function(file) {
shader_key = path.basename(file.path, '.shader');
file.contents = new Buffer('"' + shader_key + '":' + JSON.stringify(file.contents.toString()));
return file;
}))
.pipe(concat('shaders.gen.js', { sep : ',\n' }))
.pipe(wrap('Export({ shaders: {\n<%= contents %>\n}});'))
.pipe(gulp.dest('./lib/glow/'));
Object.keys(glowscript_libraries).forEach(function(lib) {
gulp.src(glowscript_libraries[lib])
.pipe(uglify())
.pipe(concat(lib + '.' + version + '.min.js'))
.pipe(header("/*This is a combined, compressed file. Look at https://github.com/BruceSherwood/glowscript for source code and copyright information.*/"))
.pipe(gulp.dest('./package/'));
});
});