-
Notifications
You must be signed in to change notification settings - Fork 1
/
base.js
41 lines (34 loc) · 823 Bytes
/
base.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
const Yargs = require('yargs')
const { argv } = Yargs
const gulpUtil = require('gulp-util')
class GulpBase {
constructor (gulp, config) {
this.gulp = gulp
this._config = config
this.util = gulpUtil
this.log = gulpUtil.log
this.port = argv.port || 8080
this.lang = argv.lang || `en`
this.region = argv.s3Region || `us-east-1`
this.release = !!(argv.release)
}
dest (_folder) {
const { distPath } = this._config
const dist = distPath || `./dist`
if (_folder) {
return this.gulp.dest(`${dist}/${_folder}`)
}
return this.gulp.dest(dist)
}
src (_folder) {
const folder = _folder || ``
return this.gulp.src(`./src/${folder}`)
}
config (_lang) {
return this._config
}
language () {
return this.lang
}
}
module.exports = GulpBase