-
Notifications
You must be signed in to change notification settings - Fork 20
/
Copy pathgulpfile.js
executable file
·39 lines (32 loc) · 941 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
38
39
const gulp = require('gulp');
const webpack = require('webpack');
const stream = require('webpack-stream');
const webpackConfig = require('./webpack.config.js');
const del = require('del');
const pkg = require('./package.json');
const replace = require('gulp-replace');
const paths = {
src: 'src',
dist: 'dist',
};
const clean = () => del([paths.dist])
const wp = () => gulp.src(paths.src)
.pipe(stream(webpackConfig))
.pipe(gulp.dest(paths.dist));
const banner = () => {
const comment =
`/*!
* ${pkg.name[0].toUpperCase() + pkg.name.slice(1)} v${pkg.version}
* ${pkg.description}
* ${pkg.homepage}
* Copyright ${new Date().getFullYear()}, ${pkg.author}
* Released under the ${pkg.license} license.
*/
`;
return gulp.src(`${paths.dist}/*`)
.pipe(replace(/^/, comment))
.pipe(gulp.dest(paths.dist));
}
const build = gulp.series(clean, wp, banner);
exports.build = build;
exports.default = gulp.series(build);