-
Notifications
You must be signed in to change notification settings - Fork 0
/
gulpfile.js
33 lines (29 loc) · 922 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
const gulp = require('gulp');
const rollup = require('rollup');
const { join } = require('path');
const getPath = filePath => join(__dirname, 'client', filePath);
const getRollupConfig = require('./getRollupConfig');
const isProd = process.env.NODE_ENV === 'prod';
gulp.task('lib', () => {
const { config, writeOption } = getRollupConfig({
entry: getPath('lib/index.js'),
dist: getPath('/dist/lib.min.js')
});
return rollup.rollup(config).then((bundle) => {
bundle.write(writeOption);
});
});
gulp.task('index', () => {
const { config, writeOption } = getRollupConfig({
entry: getPath('index.js'),
dist: getPath('/dist/index.min.js'),
withVue: true,
css: getPath('/dist/index.css'),
});
return rollup.rollup(config).then((bundle) => {
bundle.write(writeOption)
});
});
gulp.task('default', ['lib', 'index']);
if (isProd) return;
gulp.watch('./client/*.js', ['index']);