forked from ElementUI/element-theme
-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.js
38 lines (32 loc) · 952 Bytes
/
index.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
var gulp = require('gulp')
var task = require('./lib/task')
var vars = require('./lib/gen-vars')
var config = require('./lib/config')
var noop = () => {}
var build = function (opts) {
return function () {
return task.build(Object.assign(opts, {message: 'build element theme'}))
}
}
var fonts = function (opts) {
return function () {
return task.fonts(Object.assign(opts, {message: 'build theme font'}))
}
}
exports.init = function (filePath) {
filePath = {}.toString.call(filePath) === '[object String]' ? filePath : ''
vars.init(filePath)
}
exports.watch = function (opts) {
gulp.task('build', build(opts))
exports.run(opts)
gulp.watch(opts.config || config.config, ['build'])
}
exports.run = function (opts, cb) {
gulp.task('build', build(opts))
gulp.task('fonts', fonts(opts))
if (typeof cb === 'function') {
return gulp.series("build", "fonts", cb)(noop)
}
return gulp.series("build", "fonts")(noop)
}