-
Notifications
You must be signed in to change notification settings - Fork 2
/
gulpfile.babel.js
44 lines (36 loc) · 1020 Bytes
/
gulpfile.babel.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
import del from 'del';
import gulp from 'gulp';
import gulpLoadPlugins from 'gulp-load-plugins';
import browserify from 'browserify';
import babelify from 'babelify';
import source from 'vinyl-source-stream';
import buffer from 'vinyl-buffer';
const { src, dest, series } = require('gulp');
const $ = gulpLoadPlugins();
const buildFolder = 'dist';
const clean = () => del(['dist']);
const lint = () => src('src/**/*.js')
.pipe($.eslint({
fix: true,
}))
.pipe($.eslint.format())
.pipe($.eslint.failAfterError())
.pipe(dest('src'));
const build = () => {
const b = browserify({
entries: 'src/huha.js',
debug: true,
transform: babelify,
standalone: 'Huha',
});
return b.bundle()
.pipe(source('huha.js'))
.pipe(buffer())
.pipe($.sourcemaps.init({ loadMaps: true }))
.pipe($.uglify())
.pipe($.sourcemaps.write('./'))
.pipe(dest(buildFolder));
};
gulp.task('lint', lint);
gulp.task('build', series(clean, build));
gulp.task('default', series(clean, build));