-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathgulpfile.js
50 lines (43 loc) · 1.27 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
const browserSync = require('browser-sync');
const gulp = require('gulp');
const fs = require('fs');
var ncp = require('ncp').ncp;
gulp.task('build', function(){
const folders = [
'release',
'release/',
'release/static',
'release/libs',
]
folders.forEach(dir=>{
if(!fs.existsSync(dir)) {
fs.mkdirSync(dir);
console.log('📁 folder created:', dir);
}
})
gulp.src("src/**").pipe(gulp.dest('release/'))
gulp.src("resources/**").pipe(gulp.dest('release/static'))
ncp("node_modules/pixi.js", "release/libs/pixi.js", {clobber:true}, function(err){})
ncp("node_modules/jquery", "release/libs/jquery", {clobber:true}, function(err){})
ncp("node_modules/requirejs", "release/libs/requirejs", {clobber:true}, function(err){})
})
gulp.task('serve', function(){
initBrowserSync('src');
gulp.watch("src/**", function(evt){
browserSync.reload(evt.path);
});
})
function initBrowserSync(baseDir){
browserSync.init({
server:{
baseDir:baseDir,
routes:{
'/libs':"node_modules",
'/static':'resources'
}
},
single:true,
startPath:"/",
browser:"chrome"
})
}