forked from netcell/nine-patch-phaser-plugin
-
Notifications
You must be signed in to change notification settings - Fork 0
/
gulpfile.js
48 lines (41 loc) · 1.54 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
var gulp = require('gulp');
var clean = require('gulp-clean');
var browserify = require('browserify');
var source = require('vinyl-source-stream');
var babelify = require('babelify');
var uglify = require('gulp-uglify');
var rename = require('gulp-rename');
var runSequence = require('run-sequence');
gulp.task('copy:example', function() {
return gulp.src('./build/*.js')
.pipe(gulp.dest('./example/nine-patch-phaser-plugin'));
});
gulp.task('minify', function() {
return gulp.src('./build/nine-patch-phaser-plugin.js')
.pipe(rename('nine-patch-phaser-plugin.min.js'))
.pipe(uglify())
.pipe(gulp.dest('./build'));
});
gulp.task('browserify', function() {
var bundler = browserify('./src/index.js', { extensions : ['.js', '.es6'] });
bundler.transform( babelify.configure({ only : /es6/ }) );
return bundler.bundle()
.pipe(source('nine-patch-phaser-plugin.js'))
.pipe(gulp.dest('./build'));
});
gulp.task('browserify:debug', function() {
var bundler = browserify('./src/index.js', { extensions : ['.js', '.es6'], debug : true });
bundler.transform( babelify.configure({ only : /es6/ }) );
return bundler.bundle()
.pipe(source('nine-patch-phaser-plugin.js'))
.pipe(gulp.dest('./build'));
});
gulp.task('clean', function () {
return gulp.src([ './build/**/*.*', ], {read: false}).pipe(clean({force: true}));
});
gulp.task('default', function(cb) {
runSequence('clean', 'browserify', 'minify', 'copy:example', cb);
});
gulp.task('debug', function(cb) {
runSequence('clean', 'browserify:debug', 'minify', 'copy:example', cb);
});