Leo Lamprecht
9 years ago
3 changed files with 43 additions and 58 deletions
@ -0,0 +1,33 @@ |
|||||
|
import gulp from 'gulp'; |
||||
|
import del from 'del'; |
||||
|
import ext from 'gulp-ext'; |
||||
|
import babel from 'gulp-babel'; |
||||
|
import uglify from 'gulp-uglify'; |
||||
|
import help from 'gulp-task-listing'; |
||||
|
|
||||
|
gulp.task('help', help); |
||||
|
|
||||
|
gulp.task('compile', [ |
||||
|
'compile-lib', |
||||
|
'compile-bin' |
||||
|
]); |
||||
|
|
||||
|
gulp.task('compile-lib', () => |
||||
|
gulp.src('lib/**/*.js') |
||||
|
.pipe(babel()) |
||||
|
.pipe(uglify()) |
||||
|
.pipe(gulp.dest('build/lib'))); |
||||
|
|
||||
|
gulp.task('compile-bin', () => |
||||
|
gulp.src('bin/*') |
||||
|
.pipe(babel()) |
||||
|
.pipe(uglify()) |
||||
|
.pipe(ext.crop()) |
||||
|
.pipe(gulp.dest('build/bin'))); |
||||
|
|
||||
|
gulp.task('watch-lib', () => gulp.watch('lib/*.js', ['compile-lib'])); |
||||
|
gulp.task('watch-bin', () => gulp.watch('bin/*', ['compile-bin'])); |
||||
|
gulp.task('clean', () => del(['build'])); |
||||
|
|
||||
|
gulp.task('watch', ['watch-lib', 'watch-bin']); |
||||
|
gulp.task('default', ['compile', 'watch']); |
@ -1,58 +0,0 @@ |
|||||
const gulp = require('gulp'); |
|
||||
const del = require('del'); |
|
||||
const ext = require('gulp-ext'); |
|
||||
const babel = require('gulp-babel'); |
|
||||
const uglify = require('gulp-uglify'); |
|
||||
const help = require('gulp-task-listing'); |
|
||||
|
|
||||
gulp.task('help', help); |
|
||||
|
|
||||
gulp.task('compile', [ |
|
||||
'compile-lib', |
|
||||
'compile-bin' |
|
||||
]); |
|
||||
|
|
||||
gulp.task('compile-lib', () => { |
|
||||
return gulp.src('lib/**/*.js') |
|
||||
.pipe(babel({ |
|
||||
presets: ['es2015'], |
|
||||
plugins: [ |
|
||||
'syntax-async-functions', |
|
||||
'transform-async-to-generator', |
|
||||
'transform-runtime' |
|
||||
] |
|
||||
})) |
|
||||
.pipe(uglify()) |
|
||||
.pipe(gulp.dest('build/lib')); |
|
||||
}); |
|
||||
|
|
||||
gulp.task('compile-bin', () => { |
|
||||
return gulp.src('bin/*') |
|
||||
.pipe(babel({ |
|
||||
presets: ['es2015'], |
|
||||
plugins: [ |
|
||||
'syntax-async-functions', |
|
||||
'transform-async-to-generator', |
|
||||
'transform-runtime' |
|
||||
] |
|
||||
})) |
|
||||
.pipe(uglify()) |
|
||||
.pipe(ext.crop()) |
|
||||
.pipe(gulp.dest('build/bin')); |
|
||||
}); |
|
||||
|
|
||||
gulp.task('watch', ['watch-lib', 'watch-bin']); |
|
||||
|
|
||||
gulp.task('watch-lib', () => { |
|
||||
return gulp.watch('lib/*.js', ['compile-lib']); |
|
||||
}); |
|
||||
|
|
||||
gulp.task('watch-bin', () => { |
|
||||
return gulp.watch('bin/*', ['compile-bin']); |
|
||||
}); |
|
||||
|
|
||||
gulp.task('clean', () => { |
|
||||
return del(['build']); |
|
||||
}); |
|
||||
|
|
||||
gulp.task('default', ['compile', 'watch']); |
|
Loading…
Reference in new issue