Browse Source

Clean up gulpfile

master
Leo Lamprecht 9 years ago
parent
commit
43c224c436
  1. 33
      gulpfile.babel.js
  2. 58
      gulpfile.js
  3. 10
      package.json

33
gulpfile.babel.js

@ -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']);

58
gulpfile.js

@ -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']);

10
package.json

@ -7,6 +7,16 @@
"files": [
"build"
],
"babel": {
"presets": [
"es2015"
],
"plugins": [
"syntax-async-functions",
"transform-async-to-generator",
"transform-runtime"
]
},
"eslintConfig": {
"extends": "standard",
"parser": "babel-eslint",

Loading…
Cancel
Save