forked from letstri/timezz
-
Notifications
You must be signed in to change notification settings - Fork 0
/
gulpfile.js
59 lines (54 loc) · 1.07 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
51
52
53
54
55
56
57
58
59
/**
* Plugins
*/
// main plugins
const gulp = require('gulp');
const del = require('del');
const notify = require('gulp-notify');
const eslint = require('gulp-eslint');
// JS plugins
const minifyJS = require('gulp-minify');
const babel = require('gulp-babel');
/**
* Config
*/
const paths = {
dist: 'dist',
src: {
js: 'src/**/*.js',
},
};
/**
* Functions
*/
gulp.task('lint', () => {
return gulp.src(paths.src.js)
.pipe(eslint())
.pipe(eslint.format());
});
gulp.task('scripts', ['lint'], () => {
return gulp.src(paths.src.js)
.pipe(eslint())
.pipe(eslint.format())
.pipe(babel({
presets: ['es2015'],
})
.on('error', notify.onError({
message: '<%= error.message %>',
title: 'Babel Error!',
})))
.pipe(minifyJS({
ext: {
min: '.min.js',
},
preserveComments: 'some',
}))
.pipe(gulp.dest(paths.dist));
});
// Default task
gulp.task('default', ['scripts'], () => {
gulp.watch(paths.src.js, ['lint', 'scripts']);
});
gulp.task('del', () => {
return del.sync(paths.dist);
});