-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathgulpfile.js
37 lines (32 loc) · 893 Bytes
/
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
'use strict';
const gulp = require('gulp');
const rename = require('gulp-rename');
const minify = require('gulp-minify');
const rollup = require('gulp-rollup');
const destFolder = './dist';
// deletes the dist folder
gulp.task('clean', require('del').bind(null, ['dist']));
// build js
gulp.task('build', function () {
return gulp.src(['./src/*.js'])
.pipe(rollup({
format: "umd",
moduleName: "NJEvents",
entry: "./src/index.js"
}))
.pipe(rename("script.js"))
.pipe(minify({
ext:{
src:'.js',
min: '.min.js'
}
}))
.pipe(gulp.dest(destFolder));
});
// Create a new build in dist folder
gulp.task('build', gulp.series(
'clean',
'build'
));
// Watch for changes.
gulp.task('watch', () => gulp.watch(['./src/*.js'], gulp.series(['build'])));