-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathgulpfile.js
30 lines (28 loc) · 1000 Bytes
/
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
var gulp = require('gulp');
var screeps = require('gulp-screeps');
var credentials = require('./credentials.js');
var livereload = require('gulp-livereload');
var rename = require('gulp-rename');
gulp.task('screeps', function() {
gulp.src(['src/*.js', 'src/**/*.js'])
.pipe(rename(function(path){
if(path.dirname != '.'){
var path_array = path.dirname.split('/');
var new_path = '';
for(var i in path_array){
if(path_array[i] != 'main'){
new_path += (new_path.length ? '.' : '') + path_array[i];
}
}
path.basename = new_path + '.' + path.basename;
path.dirname = '.';
}
}))
.pipe(gulp.dest('dist'))
.pipe(screeps(credentials))
.pipe(livereload())
});
gulp.task('default', function() {
livereload.listen();
gulp.watch(['src/*.js','src/**/*.js'], ['screeps']);
});