-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathgulpfile.babel.js
41 lines (34 loc) · 1.01 KB
/
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
'use strict';
// This gulpfile makes use of new JavaScript features.
// Babel handles this without us having to do anything. It just works.
// You can read more about the new JavaScript features here:
// https://babeljs.io/docs/learn-es2015/
import gulp from 'gulp';
import gulpLoadPlugins from 'gulp-load-plugins';
import pkg from './package.json';
const $ = gulpLoadPlugins();
const binFolder = 'bin';
const binFile = pkg.library.name + '.js';
const sources = './src/**/*.js';
gulp.task('default', ['build']);
// Build as a Node bin
gulp.task('build', ['lint'], () =>
gulp.src([sources])
.pipe($.sourcemaps.init())
.pipe($.babel())
.pipe($.concat(binFile))
// Output files
.pipe(gulp.dest(binFolder))
);
// Lint javascript
gulp.task('lint', () =>
gulp.src(sources)
.pipe($.eslint())
.pipe($.eslint.format())
.pipe($.eslint.failOnError())
);
// Rerun the task when a file changes
gulp.task('watch', function() {
// gulp.watch(sources, ['lint']);
gulp.watch(sources, ['build']);
});