forked from ElementUI/element-theme
-
Notifications
You must be signed in to change notification settings - Fork 1
/
index.js
37 lines (32 loc) · 959 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
var gulp = require('gulp');
var series = require('run-sequence').use(gulp);
var task = require('./lib/task');
var vars = require('./lib/gen-vars');
var config = require('./lib/config');
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 series('build', 'fonts', cb);
}
return series('build', 'fonts');
};