forked from ElementUI/element-theme
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathindex.js
More file actions
30 lines (25 loc) · 994 Bytes
/
Copy pathindex.js
File metadata and controls
30 lines (25 loc) · 994 Bytes
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
const gulp = require('gulp');
const chalk = require('chalk');
const task = require('./lib/task');
const vars = require('./lib/gen-vars');
const config = require('./lib/config')();
const build = (opts) => () => task.compileSass(Object.assign(opts, { message: `${chalk.green('etg: build element theme')}\n` }));
const fonts = (opts) => () => task.copyFonts(Object.assign(opts, { message: `${chalk.green('etg: build theme fonts')}\n` }));
exports.init = (filePath) => {
const _filePath = {}.toString.call(filePath) === '[object String]' ? filePath : '';
vars.init(_filePath);
};
exports.watch = (opts) => {
gulp.task('build', build(opts));
exports.run(opts);
const varsPath = opts.vars || config.vars;
gulp.watch(varsPath, gulp.series('build'));
};
exports.run = (opts, cb) => {
gulp.task('build', build(opts));
gulp.task('fonts', fonts(opts));
if (typeof cb === 'function') {
return gulp.series('build', 'fonts', cb)();
}
return gulp.series('build', 'fonts')();
};