/
gulpfile.js
29 lines (26 loc) · 864 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
// Import `src` and `dest` from gulp for use in the task.
const { src, dest } = require('gulp');
// Import Gulp plugins.
const babel = require('gulp-babel');
const plumber = require('gulp-plumber');
const concat = require('gulp-concat');
// Gulp 4 uses exported objects as its tasks. Here we only have a
// single export that represents the default gulp task.
exports.default = function(done) {
// This will grab any file within src/components or its
// subdirectories, then ...
return src('./src/js/**/*.js')
// Stop the process if an error is thrown.
.pipe(plumber())
// Transpile the JS code using Babel's preset-env.
.pipe(concat('gallery.js'))
.pipe(babel({
presets: [
['@babel/env', {
// modules: false
}]
]
}))
// Save each component as a separate file in dist.
.pipe(dest('./dist/js'))
};