forked from codrops/RainEffect
-
Notifications
You must be signed in to change notification settings - Fork 0
/
gulpfile.js
43 lines (40 loc) · 1.04 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
var gulp = require('gulp'),
fs = require('fs'),
connect = require('gulp-connect'),
source = require('vinyl-source-stream'),
browserify = require('browserify'),
uglify = require('gulp-uglify'),
streamify = require('gulp-streamify'),
babelify = require("babelify");
function compileJS(file){
browserify('src/'+file+'.js',{debug:true})
.transform(babelify)
.transform('glslify')
.bundle()
.on("error", function (err) { console.log("Error : " + err.message); })
.pipe(source(file+'.min.js'))
.pipe(streamify(uglify()))
.pipe(gulp.dest('demo/js'));
}
gulp.task('js',['js1','js2','js3'],function(){});
gulp.task('js1',function(){
compileJS('index');
});
gulp.task('js2',function(){
compileJS('index2');
});
gulp.task('js3',function(){
compileJS('index3');
});
function watch(i){
i=i>0?i:'';
gulp.task('watch'+i,['js'+i],function(){
gulp.watch(['src/*.js','src/shaders/*.frag','src/shaders/*.vert'],['js'+i]);
});
}
for(var i=0;i<=3;i++){
watch(i);
}
gulp.task('connect', function() {
connect.server();
});