@@ -12,64 +12,64 @@ const stripComments = require('gulp-strip-comments');
1212const merge = require ( 'merge-stream' ) ;
1313
1414gulp . task ( 'build' , function ( ) {
15- const gpu = browserify ( './src/browser.js' )
16- . ignore ( 'gl' )
17- . bundle ( )
18- . pipe ( source ( 'gpu-browser.js' ) )
19- . pipe ( buffer ( ) )
20- . pipe ( stripComments ( ) )
21- . pipe ( header ( fs . readFileSync ( './src/browser-header.txt' , 'utf8' ) , { pkg : pkg } ) )
22- . pipe ( gulp . dest ( 'bin' ) )
23- . on ( 'error' , console . error ) ;
15+ const gpu = browserify ( './src/browser.js' )
16+ . ignore ( 'gl' )
17+ . bundle ( )
18+ . pipe ( source ( 'gpu-browser.js' ) )
19+ . pipe ( buffer ( ) )
20+ . pipe ( stripComments ( ) )
21+ . pipe ( header ( fs . readFileSync ( './src/browser-header.txt' , 'utf8' ) , { pkg : pkg } ) )
22+ . pipe ( gulp . dest ( 'bin' ) )
23+ . on ( 'error' , console . error ) ;
2424
25- const gpuCore = browserify ( './src/browser.js' )
25+ const gpuCore = browserify ( './src/browser.js' )
2626 . ignore ( 'gl' )
27- . ignore ( 'acorn' )
28- . bundle ( )
29- . pipe ( source ( 'gpu-browser-core.js' ) )
30- . pipe ( buffer ( ) )
31- . pipe ( stripComments ( ) )
32- . pipe ( header ( fs . readFileSync ( './src/browser-header.txt' , 'utf8' ) , { pkg : pkg } ) )
33- . pipe ( gulp . dest ( 'bin' ) )
34- . on ( 'error' , console . error ) ;
27+ . ignore ( 'acorn' )
28+ . bundle ( )
29+ . pipe ( source ( 'gpu-browser-core.js' ) )
30+ . pipe ( buffer ( ) )
31+ . pipe ( stripComments ( ) )
32+ . pipe ( header ( fs . readFileSync ( './src/browser-header.txt' , 'utf8' ) , { pkg : pkg } ) )
33+ . pipe ( gulp . dest ( 'bin' ) )
34+ . on ( 'error' , console . error ) ;
3535
36- return merge ( gpu , gpuCore ) ;
36+ return merge ( gpu , gpuCore ) ;
3737} ) ;
3838
3939/// Minify the build script, after building it
4040gulp . task ( 'minify' , function ( ) {
41- const gpu = gulp . src ( 'bin/gpu-browser.js' )
42- . pipe ( rename ( 'gpu-browser.min.js' ) )
43- . pipe ( header ( fs . readFileSync ( './src/browser-header.txt' , 'utf8' ) , { pkg : pkg } ) )
44- . pipe ( gulp . dest ( 'bin' ) )
45- . on ( 'error' , console . error ) ;
41+ const gpu = gulp . src ( 'bin/gpu-browser.js' )
42+ . pipe ( rename ( 'gpu-browser.min.js' ) )
43+ . pipe ( header ( fs . readFileSync ( './src/browser-header.txt' , 'utf8' ) , { pkg : pkg } ) )
44+ . pipe ( gulp . dest ( 'bin' ) )
45+ . on ( 'error' , console . error ) ;
4646
47- const gpuCore = gulp . src ( 'bin/gpu-browser-core.js' )
48- . pipe ( rename ( 'gpu-browser-core.min.js' ) )
49- . pipe ( header ( fs . readFileSync ( './src/browser-header.txt' , 'utf8' ) , { pkg : pkg } ) )
50- . pipe ( gulp . dest ( 'bin' ) )
51- . on ( 'error' , console . error ) ;
47+ const gpuCore = gulp . src ( 'bin/gpu-browser-core.js' )
48+ . pipe ( rename ( 'gpu-browser-core.min.js' ) )
49+ . pipe ( header ( fs . readFileSync ( './src/browser-header.txt' , 'utf8' ) , { pkg : pkg } ) )
50+ . pipe ( gulp . dest ( 'bin' ) )
51+ . on ( 'error' , console . error ) ;
5252
53- return merge ( gpu , gpuCore ) ;
53+ return merge ( gpu , gpuCore ) ;
5454} ) ;
5555
5656
5757/// The browser sync prototyping
5858gulp . task ( 'bsync' , function ( ) {
59- // Syncs browser
60- browserSync . init ( {
61- server : {
62- baseDir : './'
63- } ,
64- open : true ,
65- startPath : "./test/html/test-all.html" ,
66- // Makes it easier to test on external mobile devices
67- host : "0.0.0.0" ,
68- tunnel : true
69- } ) ;
59+ // Syncs browser
60+ browserSync . init ( {
61+ server : {
62+ baseDir : './'
63+ } ,
64+ open : true ,
65+ startPath : "./test/html/test-all.html" ,
66+ // Makes it easier to test on external mobile devices
67+ host : "0.0.0.0" ,
68+ tunnel : true
69+ } ) ;
7070
71- // Detect change -> rebuild TS
72- gulp . watch ( [ 'src/**.js' ] , [ 'minify' ] ) ;
71+ // Detect change -> rebuild TS
72+ gulp . watch ( [ 'src/**.js' ] , [ 'minify' ] ) ;
7373} ) ;
7474
7575/// Auto rebuild and host
@@ -78,12 +78,14 @@ gulp.task('default', gulp.series('minify','bsync'));
7878/// Beautify source code
7979/// Use before merge request
8080gulp . task ( 'beautify' , function ( ) {
81- return gulp . src ( [ 'src/**/*.js' ] )
82- . pipe ( jsprettify ( {
83- indent_size : 3 ,
84- indent_char : ' ' ,
85- indent_with_tabs : true
86- } ) )
87- . pipe ( gulp . dest ( 'src' ) ) ;
81+ return gulp . src ( [ 'src/**/*.js' ] )
82+ . pipe ( jsprettify ( {
83+ indent_size : 2 ,
84+ indent_char : ' ' ,
85+ indent_with_tabs : false ,
86+ eol : '\n' ,
87+ brace_style : 'preserve-inline'
88+ } ) )
89+ . pipe ( gulp . dest ( 'src' ) ) ;
8890} ) ;
8991
0 commit comments